CakePHP Migrations is an add-on that we will be using to make database maintenance easier.
Testing that migrations are workingFirst, make sure you have PEAR installed. Navigate to ./cake migrate help
Get CakePHP Migrations running
Editing the YAML fileNow this will generate a YAML file to create your database tables in the
UP:
create_table:
test:
name:
description: text
count: integer
is_active: boolean
DOWN:
drop_table: test
Before making a new migration file, make sure to check out the example YAML migration files Whenever you want your database to have all the migrations applied to them, execute the following command:
This will run all the YAML and generate all the tables and it's fields onto your local database. This will allow us to create new tables for our program using YAML files. We can then commit those YAML files to our Subversion repository so everyone on the team can perform Migrations and fixtures after a Subversion updateHere is what you should run after each time you update from subversion: ./cake migrate And if you want to load in a bunch of test data from the fixtures, run ./cake fixtures MiscTo reset your database and load all the data in from fixtures, run ./cake migrate reset ./cake migrate ./cake fixtures
./cake fixtures g fromdb -force More
|