【问题标题】:laravel update table with artisan migration带有工匠迁移的 laravel 更新表
【发布时间】:2016-05-27 19:17:05
【问题描述】:

我只是创建一个迁移并使用命令运行迁移,这里是我键入的命令和我得到的结果;

Serkan:itsp mehmet$ php artisan make:migration alter_table_rates --path="database/migrations/v141/" --table="rates"
Created Migration: 2016_05_27_120219_alter_table_rates
Serkan:itsp mehmet$ php artisan migrate
Nothing to migrate.

这里是新的迁移文件内容,我只是添加了新的列('purchase'):

 public function up()
    {
        Schema::table('rates', function (Blueprint $table) {
            $table->integer('purchase')->nullable();
        });
    }
    public function down()
    {
        Schema::table('rates', function (Blueprint $table) {
            $table->dropColumn(['purchase']);
        });
    }

你认为这会导致什么?

【问题讨论】:

    标签: laravel-5 laravel-migrations


    【解决方案1】:

    这是因为您在另一个目录中创建它。你应该像这样运行它:

    php artisan migrate --path=database/migrations/v141
    

    【讨论】:

      猜你喜欢
      • 2015-11-24
      • 2016-07-08
      • 2019-04-22
      • 2018-12-02
      • 1970-01-01
      • 2016-04-06
      • 2014-06-01
      • 1970-01-01
      • 2015-04-07
      相关资源
      最近更新 更多