我正在嘗試通過這樣做來修改現有遷移: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 關注
- 102 瀏覽
添加回答
舉報
0/150
提交
取消