Hello,
It is my understanding that Migrations are used as a safety precaution in case things do go bad but…
What I cannot work out is how to create in the migration file the data that goes in it.
For example, lets say I am in the root of the app and type in GIT BASH yii migrate/create my_first-migration
A file is created:
m150415_202300_my_first-migration
But in that file, everything is empty:
<?php
use yii\db\Schema;
use yii\db\Migration;
class m150415_202300_my_first-migration extends Migration
{
public function up()
{
}
public function down()
{
echo "m150415_202300_add_book_table cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}
Is there a way to get the migration synthax fast rather than typing everything by hand? As I am not understanding the point of creating this safety precaution if we can still make a synthax mistake and cause some problems to the database later on on migrate up.
Thank you in advance for your explanations.
Ben