Currently what I do when a new semester begins in my Moodle installation, is do a mysqldump of the current semester database and then restore it to another database for the new semester, then I copy the complete folder for the current semester into a new folder for the new semester. Then I "reset" the new semester installation to start anew, without assignments, grades, and with new students.
It has been done like this for a few years, so now I have a dozen databases and a dozen folders, one for each semester since I started using Moodle.
Is this the correct way of doing it? I think there should be a cleaner way, each time I have to do this it takes a long time to create the new semester, and of course my server is going to be out of space soon.
Related
I am using Entity Framework and I have a table that I use to record some events that gets generated by a 3rd party. These events are valid for 3 days. So I like to clean out any events that is older than 3 days to keep my database table leaner. Is there anyway I can do this? Some approach that won't cause any performance issue during clean up.
To do the mentioned above there are some options :
1) Define stored procedure mapped to your EF . And you can use Quarts Trigger to execute this method using timely manner.
https://www.quartz-scheduler.net
2) SQL Server Agent job which runs every day at the least peak time and remove your rows.
https://learn.microsoft.com/en-us/sql/ssms/agent/schedule-a-job?view=sql-server-2017
If only the method required for cleaning purpose nothing else i recommend you go with option 2
first of all. Make sure the 3rd party write a timestamp on every record, in that way you will be able to track how old the record is.
then. Create a script that deletes all record that are older than 3 days.
DELETE FROM yourTable WHERE DATEDIFF(day,getdate(),thatColumn) < -3
now create a scheduled task in SQL management Studio:
In SQL Management Studio, navigate to the server, then expand the SQL Server Agent item, and finally the Jobs folder to view, edit, add scheduled jobs.
set script to run once every day or whatever please you :)
Our customer has an existing store based on FEP4/Madisons migrated all the way from several major versions ago WCS. They want to transition to a new store based on Aurora. The logic project and front-end interaction with it is not up to date at all, so along the way we want to migrate that.
We are trying to make a rough plan for the project.
The other guys in the company (who are unavailable right now - great!) have told me that their experience is that while a FEP upgrade should only take about a week, it always end up taking at least a month.
I am trying to establish if there is a big time difference between these two scenarios:
Scenario 1: "I want to upgrade an existing Madisons-based store and the associated WCS infrastructure and DB2 schema/data from FEP4 to FEP6" In this world we keep the existing development images and the various other servers along from dev to PROD, and upgrade the existing store + infrastructure to FEP6 before we start building the new store.
Scenario 2: "I want to create an entirely new store based on Aurora and the existing data for the old store, and upgrade the associated WCS infrastructure and DB2 schema/data from FEP4 to FEP6". In this world we create all new environments for dev ... prod, and so have a FEP4 branch for the current store, and a FEP6 branch for the new store.
Can you perhaps give a rough estimate of how long to would take, and how the time will be (roughly) distributed over these four headlines A very rough estimate is fine...
Upgrade/install WCS components : _ % of time
Upgrade/migrate DB2 schema and data: _ % of time
Upgrade and fix front end issues: _ % of time
"Other tasks": _ %
Upgrade/install WCS components : 1.5 day
Upgrade/migrate DB2 schema and data: % of time (no need to migrate DB2 schema) just publish Aurora and copy Aurora store JSP's to your Madisons Store. you should do Madisons to Aurora migration .
Upgrade and fix front end issues: _ % of time it's [depend on your customization.]
Thanks
i have a sqlite file in my app. the app is with enterprise certificate .
Now , if i am going to create new version with the changes in database then :
1) i have to change my Sqlite file name ?
2) if yes , then is there any way that if any person who is using my app, who has his saved data in app , will be inserted automatically in new version of my app .
otherwise if i create new file and then the older data would be removed!!!
Thanks in advance..
1) AFAIK, when you update, the old app bundle is replaced with the new app bundle. But the user data is untouched. i.e. the copy of the sqlite DB which the app changes with use by the user, is not deleted/replaced.
2) So, you can possibly ship changes to the DB as queries:
a) New tables go in as CREATE TABLE queries.
b) Changes to table structure go in as ALTER TABLE queries.
3) Now, one problem is, you didn't think about all this when you shipped the older version. So how will you make sure the queries 2a and 2b are executed only on upgrade?
a) When you first get control in the application, before allowing user interaction, fire a dummy SELECT SINGLE * FROM <tablename> on a table you have 'changed' in new version.
b) Use sqlite3_column_count and sqlite3_column_name to find out which version of the app the DB corresponds to [old or new].
c) If it is new version (i.e. new columns already exist), do nothing, else fire the queries I mentioned earlier as 2a and 2b.
If you haven't started by using this, then it's probably moot, but Core Data handles migrations (IMHO) fairly well; enough that it's worth the hurdle of learning the API. We've had great success with it (including complex migrations, inserting new objects "between" relationships, etc).
For a couple of weeks now, I have been working on migrating my client from using Corel Paradox to Microsoft Access since Paradox has been long dead and it finally became unusable in a practical matter for my client.
As most of my development however is in server side work, my knowledge of VBA and TSQL is fairly basic which is why I'm having a bit of trouble grasping the logic required for the following task:
As part of the routine scripts run for database maintenance and updates (of customer info such as courses attended, date created, date of the last record change, address, etc.) all customers are given a "date created" to mark when they first became clients, and a "date updated" which is simply the date of any changes to the customer file.
Now, the sticking point on my end is that in the database tables we have eight fields (with date fields also) for types of courses attended by the customer.
When we were using Paradox, we had a script which would compare the master database against our quarterly data set, and where duplicates were found the script would take the courses and push them back one and insert the latest course data.
Additionally the script would take the record which was most recent and update any personal information where changed.
While I've gotten most of the scripts done, I'm having a lot of trouble figuring out how to recreate that feature of pushing back older dates to make room for the new records.
I have a feeling this is something which can be done with arrays, however after reading up on tSQL and VBA, I'm not sure which tool is right for the job.
Thanks in advance for any assistance
This is not an answer but an attempt to understand what you are trying to do.
The key phrase seems to be "I'm having a lot of trouble figuring out how to recreate that feature of pushing back older dates to make room for the new records."
Does this sentence mean you have a customer record like this:
| Oldest | | | | | | Newest |
Course|Date|Course|Date|Course|Date|Course|Date|Course|Date|Course|Date|Course|Date|
Then when the the customer attends a new course, you discard the oldest Course/Date, move the others left one slot and insert the new Course/Date at the end.
Please, please tell me I have misunderstood! This is the sort of trick we got up to before the days of relational databases. What if the customer attends more than eight courses in a quarter? We've let the DBMS handle these complications for the last 30 years.
You should have a Course Attended table, linked to the customer, with attributes Course and Date. All you have to do is add a new record for each new attendance. If you want a routine that deletes the older Attendance records from the Course Attended table then write one. If they want a routine that displays the 8 most recent attendances, write an SQL query to get them.
I developed an application where the user can create tasks (like a an agenda, ERP or CRM)
So, the user creates a task and that task has an expiration date. The idea is to erase the entry when the task expires.
I've been thinking solutions, like having a timer and so, but:
There is any method or way to create data that expires?? I mean, does MySQL, MSSQL (or any DB Manager) support something like this natively?
I would be great to have something like this:
CREATE TABLE [MyTASK] (expires on mydate action = DELETE){
mydate,
mysomething,
myagain
}
And then, the FakeSQL erases the data when the field "mydate" expires.
Data won't expire itself. You'll have to run something to find and remove it.
MS SQL Server supports the concept of scheduled jobs. So you can specify a stored proc that erases anything over (say) a week old, and configure that job to run every night.
mySQL seems to have Event Schedulers since 5.1.
If storage space is not an issue, it's worth a thought about putting in a bit field to mark a record as deleted so that none of your data is lost in case you want to add a part to your application that can look at all previous tasks. Like some administrative tools. Let's say employees are making tasks, and a task has expired and you don't want normal users to be able to modify or access expired tasks, so you "Delete" them when they expire. But one day the big boss comes along and says he wants a list of all tasks in the last year. This bit field could come in handy. It's just a thought and there may be better suggestions out there