Many technical tips already explain how to upgrade your old database to the current version of 4th Dimension. The purpose of this tech tip is to cover additional points.
The current versions of 4th Dimension can convert directly almost any database version. For example, 4th Dimension v6.7 and v6.8 can convert databases upwards from v2.0. Why "only" from v2.0 and not earlier versions? Version 2 of 4D cannot upgrade databases created with version 1 of 4D; that upgrade requires the use of a conversion tool. So, as of today, 4th Dimension v6.8 can upgrade databases from v2.0 to v6.7.
When upgrading, you may encounter some problems due to structure or data file corruption.
Here are some steps and guidelines that should help you upgrade smoothly, should a problem arise:
1) Always have a backup copy of your database.
2) Disable all methods that may be executed when the database is opened (such as Startup or On Startup methods). You might have to run 4D Tools to repair the data file. You just need to avoid modifying the data file more than is requested by the upgrade itself.
3) Update your plug-ins to the versions that are recommended for the version of 4D that you are going to use. With a resource editor such as Resedit, remove all plug-ins that could be stored in the structure file. Plug-ins have to be located now in the Mac4DX/Win4DX folders. If you do have older plug-ins installed in your structure file, it is likely that you are using 68K plug-ins. You might need to update them or be prepared to modify your database by removing these calls.
As an example, one of the most common external routines (old naming convention for plug-ins) was Buttonpackage. This allowed you to have 3D buttons in your forms in version 3 databases. This external routine is no longer available and furthermore, 4D does have native 3D buttons. You may have to update all of your forms in order to remove calls to this external routine and changing them to regular 3D buttons. Of course, these modifications will be performed after upgrading the database.
Once the previous steps have been performed, backup your database and upgrade it directly to the version of 4D that you want to use. After converting the structure file and data file, you may run 4D Tools to check the structure file and the data file. A recover by tag may be required. You can always perform a 'preventative' recover by tag as it may fix an invisible issue that could later generate data corruption.
- When this is performed, your database may not run properly because of one of the following reasons:
1) Some plug-ins are missing and/or need to be updated.
2) You are using obsolete commands and you may need to adapt your code to the new language.
3) You are running in version 2 compatiblity mode. You may have to deactivate this compatibility and, using Resedit, open your structure file and delete the BBOX resource. You may also need to remove the CUST resource.
Sometimes, a direct upgrade may not be the best option, as it could generate too many problems. In this case, you will want to perform upgrades using intermediate versions of 4D. To use an intermediate version of 4D for upgrade purposes, you do not need a serial number because a Demo version will suffice.