Skip to content

Instantly share code, notes, and snippets.

@dmertl
Created August 26, 2013 18:35
Show Gist options
  • Save dmertl/6344897 to your computer and use it in GitHub Desktop.
Save dmertl/6344897 to your computer and use it in GitHub Desktop.
Make database changes
The first step in creating a migration is to make any schema changes to the database. If the changes are to the data only you can skip this step.
Create migration file
Next we create a migration file with the differences between the current app/Config/Schema/schema.php file and the database. To do this execute the Console/cake Migrations.migration generate command with the following options:
Do you want compare the schema.php file to the database? - y
Do you want to preview the file before generation? - n
Please enter the descriptive name of the migration to generate: - Name of migration
Do you want update the schema.php file? - y
Schema file exists. Would you like to do? (o/s/q) - o
Now we have a migration file to update our database schema and an up to date schema.php file. Open the new migration file and add a description of the migration to the $description variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment