迁移文件
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->longText('content');
$table->string('short_description');
$table->unsignedInteger('media_id')->nullable();
$table->foreign('media_id')->references('id')->on('medias');
$table->unsignedInteger('creator_id');
$table->foreign('creator_id')->references('id')->on('users');
$table->boolean('hide')->default(0);
$table->timestamps();
});
}
在隐藏列之后,我想添加“隐私列”
答案 0 :(得分:2)
要么将其添加到迁移文件中,要么创建另一个迁移,如下所示:
Schema::table('posts', function (Blueprint $table) {
$table->string('privacy')->after('hide');
});