==== How to Migrate ==== This page describes how to migrate to and from various versions of your schema within Akelos. This is not a guide on how to migrate *to* Akelos from another framework. ==== The Dilemma ==== Let's say that you've got your Booklink application up and running, and are fairly happy with it, but you would like to add one thing: a special field for the number of pages in the book. You already have over 50 books in the database, and you don't really want uninstall and reinstall the database, as that would remove all of the existing books. What do you do? ==== The Solution: Migrate ==== Adding or removing columns from an existing table is not that hard really. Remember creating %%app/installers/booklink_installer.php%%? We're going to need to modify that file again, and run a script to update our schema. Ready? - Locate and open booklink_installer.php for editing in your favorite text editor. - At the bottom of the file notice the last bracket " } ". - Just before that bracket, place this text: * function up_2(){ $this->addColumn('books','pages'); } function down_2(){ $this->removeColumn('books','pages'); } - Save and close the booklink_installer.php file. - Run this script: ./script/migrate Booklink install 2 The above code means "install **to** version two". If you just want to upgrade to the most recent version, do a simple ./script/migrate Booklink install You may need to regenerate your Book scaffolding by running the following: ./script/generate scaffold Book To downgrade to version one, use this code:./script/migrate Booklink uninstall 1 The above code means "uninstall **to** version one". Using migrate keeps your existing data safe, and allows a trackable way to upgrade and downgrade. That's it! Thanks for tuning in. ;-)