yii2 /迁移不起作用

时间:2017-03-11 07:02:03

标签: yii2 yii2-advanced-app

 public function up() {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
        $columns = [
            'id' => $this->primaryKey(),
            'name' => $this->string(255)->notNull(),
            'price' => $this->decimal(10, 2)->notNull()->defaultValue(0),
            'original_price' => $this->decimal(10, 2)->notNull()->defaultValue(0),
            'special_price' => $this->decimal(10, 2)->notNull()->defaultValue(0),
            'comment' => $this->string(10),
            'is_deleted' => $this->boolean()->defaultValue(0),
            'created_at' => $this->dateTime()->notNull(),
            'updated_at' => $this->ti`enter code here`mestamp()
        ];
        $this->createTable('tbl_ironing_order_item', $columns, $tableOptions);
    }

我正在使用yii2框架,我在服务器迁移上部署项目运行正常,最近创建新模块,迁移不在服务上运行,没有显示任何错误, 如何在部署时运行迁移?

1 个答案:

答案 0 :(得分:1)

确保迁移文件位于控制台/迁移目录中。 如果它们不在该目录中,您可以指定它们所在的目录。

运行

php yii migrate/up --migrationPath=@vendor/path/to/your/migrations
相关问题