Skip to content

Instantly share code, notes, and snippets.

@nabeeljaved
Created September 19, 2017 17:04
Show Gist options
  • Save nabeeljaved/0aa7b52fc0a3f365ea2a46d2d2c2defe to your computer and use it in GitHub Desktop.
Save nabeeljaved/0aa7b52fc0a3f365ea2a46d2d2c2defe to your computer and use it in GitHub Desktop.
Add your database connection settings to protected/config/console.php.
Run yiic migrate create initial to create the stub code for the migration.
Copy contents of this gist to protected/commands/InitialDbMigrationCommand.php.
Run yiic initialdbmigration 'name_of_your_database' > initial_migration.php to generate up() and down() methods for initial database migration.
Copy and paste up() and down() methods from initial_migration.php to the file created in the protected/migrations folder in step 2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment