我正在尝试通过执行以下操作来修改现有的迁移:
c:\wamp64\www\urlshortner>php artisan make:migration add_unique_to_shortened_on_urls_table_--table=urls
我将此代码添加到迁移文件中:
public function up()
{
Schema::table('urls', function (Blueprint $table) {
$table->unique('shortned');
});
}
我运行了PHP artisan migrate命令,但是该字段在MySQL上不是“唯一”
您能帮我吗?