【问题标题】:yii2 / Migration Not Workingyii2 / 迁移不工作
【发布时间】:2017-03-11 07:02:03
【问题描述】:
 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 框架,我在服务器上部署项目迁移运行正常,最近创建了迁移不在服务上运行的新模块,没有显示任何错误, 如何在部署时运行迁移?

【问题讨论】:

  • 你必须运行php yii migrate。请记住,文件需要遵循 mugrations 的命名约定。

标签: yii2 yii2-advanced-app


【解决方案1】:

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

运行

php yii migrate/up --migrationPath=@vendor/path/to/your/migrations

【讨论】:

    猜你喜欢
    • 2015-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多