Saving Sequential Back Ups During Development
Ok, we know we need to save regular back ups during development. FileMaker saves the changes you make automatically, so if you make design changes that you later decide to discard and you want to revert back to an older version, you can't do it unless you have made and kept periodic copies of your file during the development process. Not only should you save a copy frequently, but you should give each back up a new file name each time so your new copy doesn't overwrite any existing back ups. This is so you can refer back to more than just the last save should you need to do so.
But that requires disciplining yourself to make copies on a regular interval and with a consistent naming convention to make it easy to tell the age of each saved copy. And there's the rub. I'm just as lazy as the next guy and when you add to that the state of intense concentration that I routinely enter during development and I'm just not very likely to make those backups.
If I had a nickel for every time I made changes to my database, had a different idea and found myself rebuilding parts of my database to match an earlier version just because I didn't make those copies...
Well no more, I've come up with a set up that saves my back up copies for me so that I no longer have to. The scripts needed turned out to be very simple and the "save" hasn't interfered noticeably with my development process though I have only started using this method for a very short time. I may be posting back here with future variations if I discover the need.
The one potential issue that I'm aware of is that this method uses Install OnTimer Script to automate the regular back ups. Since you can only have one installed timer for any given window, testing any script that uses this script step will halt the automatic back ups. I figure this won't be a big deal in most projects because Install OnTimer Script isn't a step I make frequent use of and if I need to, I can add a New Window step to the script so that my timer is installed in a different window.
I've created 3 scripts: Here are their names, steps and the reason for each one:
Developer's Friend A: This script Installs the timer to run every time the specified number of minutes elapses. 15 minutes may seem excessively frequent, but when you are busily making numerous changes, it may not be often enough!
#This script uses Install On Timer and the Developer's Friend B script to save a copy of this file every $Interval minutes.
#File Options is used to call this script for the first time to set up the regular, automated sequential backups.
#And I can manually perform this script to start the regular back ups at any time after halting the timer.
Set Variable [ $Interval; Value:15 //minutes ]
Install OnTimer Script [ “Developer's Friend B”; Interval: $Interval * 60 ]
Developer's Friend B: This script does the actual save a copy and I can perform this script any time I want to make a back up even if the timer isn't currently installed.
#When called, this script saves a copy of the record with today's date and a serial number appended to the file name.
#This simiplifies and speeds the process of saving multiple sequential back up copies during development.
Set Variable [ $Path; Value:Let ( [ F = Get ( FilePath ) ] ;
Left ( F ; Position ( F ; "." ; Length ( F ) ; -1 ) - 1 ) & " " &
Substitute ( Get ( CurrentTimeStamp ) ; ["/" ; "-"] ; [":" ; " " ] ) & ".fp7"
) // Let ]
Save a Copy as [ “$Path” ] [ copy of current file ]
Halt OnTimer: Should I need to shut down the timer without closing the file, (Say I need to take a break...), I can run this script to halt the regular back ups.
#Install OnTimer Script with no parameters halts any installed timer on the current window.
Install OnTimer Script [ ]