我正在尝试通过这样做来修改现有迁移: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 上不是“唯一的”你能帮我吗 ? Illuminate\Database\QueryException : SQLSTATE[42S21]: Column already exists: 1060 Nom du champ 'shortned' déjà utilisé (SQL: alter table `urls` add `shortned` varchar(255) not null)这是我收到的错误
3 回答
- 3 回答
- 0 关注
- 114 浏览
添加回答
举报
0/150
提交
取消