0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Laravel】複合ユニーク制約を削除する方法

Posted at

テーブルのユニーク制約を外す場合、マイグレーションファイルでdropUniqueを使用する。

複合ユニーク制約を外す場合、複合ユニーク制約作成時に第2引数に指定したindex名を使用できる。

例:
ユニーク制約の追加時

    Schema::table('programs', function (Blueprint $table) {
        $table->unique(['program_id', 'account_id'], 'unique_program');
    });

ユニーク制約を外す時

    Schema::table('programs', function (Blueprint $table) {
        $table->dropUnique('unique_program');
    });
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?