laravel 通过迁移文件改变数据表某字段类型

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('free_resources', function (Blueprint $table) {
            DB::statement("ALTER TABLE free_resources CHANGE COLUMN type type  VARCHAR(255)  DEFAULT '' comment '资料类型' ");

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('free_resources', function (Blueprint $table) {
            $table-dropColumn('type');
        });
    }

 

最新回复(0)
/jishuhW_2B2XXPfSiOz_2FGNozXTsqb3bV5aZN85AePLq1g_3D_3D4858552
8 简首页