-
Notifications
You must be signed in to change notification settings - Fork 13
Command Line Options
Migrates to the the most recent version (the newest migration file)
cake migrate
Migrates to the specified version number.
cake migrate [version]
Example: This will migrate up or down to version 2.
cake migrate 2
Generates a migration file with the given name migration name. Migration name must be alphanumeric, but can include spaces, hyphens and underscores.
cake migrate generate|gen|g [name?]
Example: This will generate a migration file called
001_my_first_migration.yml
cake migrate g my_first_migration
Generates a migration file for the specified table(s). The YAML is generated from the actual database table. If no tables are passed, it generates one single migration file called full_schema.yml
using your current database tables.
cake migrate generate|gen|g from db [table2 ...?]
Example: This will generate a migration file for each given table name (which must already exist in the DB), and populate the file with the schema found in each table.
cake migrate g from db users groups
Example: This will generate a
full_schema.yml
migration file, containing the schema for all existing tables in your database.cake migrate g from db
Generates the cake sessions table.
cake migrate generate|gen|g sessions
Generates a migration file that will create a table with the given underscored table_name
.
cake migrate generate|gen|g create table_name
Example: This will generate a migration file called
001_create_users.yml
and will attempt to build the default YAML to create a table calledusers
.cake migrate g create users
Runs and migrates the full_schema.yml
migration file if it exists.
cake migrate from_schema
Drops all tables and resets the current version to 0
cake migrate reset
Migrates down to 0 and back up to the latest version
cake migrate all
Migrates down to the previous current version
cake migrate down
Migrates up from the current to the next version
cake migrate up
Displays the Help
cake migrate help
Append -ds data_source
to the command if you want to specify the data source to use from database.php