| 76 | Since this is typically the most difficult change for a site to cope with, and the most dangerous |
| 77 | (since it risks data loss or corruption), it may be best to tackle this first. |
| 78 | |
| 79 | When the database schema changes in a way that requires conversion of the database, then we would |
| 80 | like to provide a script to perform the conversion. This is not an unusual requirement. For |
| 81 | instance, in a Ruby on Rails system, migration scripts are mandatory -- the schema is defined as |
| 82 | the result of applying all migration scripts in order. In an Eden, or more generally, Web2py |
| 83 | system, the schema is defined directly, so there is no onus on the developer to write a migration |
| 84 | script. Developers typically delete their database and reload sample data from csv files, so do |
| 85 | not have a need to migrate existing databases. Thus, writing a migration script seems a burden. |
| 86 | |
| 87 | The goal is thus to assist the developer in producing migration scripts, which they would then |
| 88 | include along with the changes that necessitate the migration, when they submit those changes to |
| 89 | the main repository. |
| 90 | |
| 91 | A site performing an upgrade would then run an overall migration script that would create a copy |
| 92 | of the database, and apply all the individual migration scripts starting from the site's current |
| 93 | Eden revision, to the upgrade revision. The site would then test using the new database, and if |
| 94 | ok, retire the previous database. |
| 95 | |
| 96 | Detailed discussion of database migration (originally for a GSoC project): BluePrintDatabaseMigration |
| 97 | |
| 98 | GSoC 2012 database migration project: [wiki:Event/2012/GSoC/DatabaseMigration Event/2012/GSoC/DatabaseMigration] |
| 99 | |
| 100 | Current state and more discussion: BluePrint/DatabaseMigration |
| 101 | |