Changeset 5482
- Timestamp:
- 10/12/07 13:50:04 (6 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelMigrationsLightPlugin/trunk/README
r5481 r5482 1 1 = sfPropelMigrationsLightPlugin = 2 2 3 Easily change the database structure without loosing any data. 3 Easily change the database structure without loosing any data. 4 4 5 5 == What it is == … … 7 7 Migrations are a cool thing that I first saw in [http://www.rubyonrails.org/ RoR]. They allow you to change the database structure between application revisions without losing data, in essence "a system that automates the process of keeping the schema just as flexible as the code basis as soon as your application enters maintanance or production". Have a look at their [http://media.rubyonrails.org/video/migrations.mov screencast] to see what it is all about. 8 8 9 This plugins is called "light", because it doesn't do any RDBMS-abstraction. So you'll have to manually write SQL code. It currently works quite alright for me, though. 9 This plugins is called "light", because it doesn't do any RDBMS-abstraction. So you'll have to manually write SQL code. It currently works quite alright for me, though. And you don't have to write all the SQL code manually of course. Actually you'll just make a {{{diff}}} of the {{{schema.sql}}} file created by propel and copy'n'paste the right parts of it in a new migration file. 10 10 I think something more general is planned for [http://propel.phpdb.org/trac/wiki/Development/Roadmap Propel 2.0]. 11 11 … … 28 28 Then put code into the {{{up()}}} and {{{down()}}} methods. 29 29 The {{{up()}}} code should bring the DB structure to the new version. The {{{down()}}} method should revert what was done in {{{up()}}}. 30 To do that you can use the parent class' (sfMigration) methods, e.g. {{{executeSQL()}}}. 30 To do that you can use the parent class' (sfMigration) methods, e.g. {{{executeSQL()}}}. Have a look at the [source:plugins/sfPropelMigrationsLightPlugin/trunk/lib/sfMigration.class.php source code] to see what else there is. 31 31 32 32 This might look like that in a simple case: