From a58a206b868ac9e108a3724cdad012a08e4c1058 Mon Sep 17 00:00:00 2001 From: shibafu Date: Sat, 16 May 2020 17:01:14 +0900 Subject: [PATCH] =?UTF-8?q?metadata.url=E3=82=92PK=E3=81=AB=E3=80=81tags.n?= =?UTF-8?q?ame=E3=82=92UNIQUE=E3=81=AB=E8=A8=AD=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...16_165243_make_primary_key_on_metadata.php | 34 +++++++++++++++++++ ...6_165705_add_unique_constraint_to_tags.php | 32 +++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 database/migrations/2020_05_16_165243_make_primary_key_on_metadata.php create mode 100644 database/migrations/2020_05_16_165705_add_unique_constraint_to_tags.php diff --git a/database/migrations/2020_05_16_165243_make_primary_key_on_metadata.php b/database/migrations/2020_05_16_165243_make_primary_key_on_metadata.php new file mode 100644 index 0000000..a774065 --- /dev/null +++ b/database/migrations/2020_05_16_165243_make_primary_key_on_metadata.php @@ -0,0 +1,34 @@ +dropIndex(['url']); + $table->primary('url'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('metadata', function (Blueprint $table) { + $table->dropPrimary(['url']); + $table->index('url'); + }); + } +} diff --git a/database/migrations/2020_05_16_165705_add_unique_constraint_to_tags.php b/database/migrations/2020_05_16_165705_add_unique_constraint_to_tags.php new file mode 100644 index 0000000..07f6d7e --- /dev/null +++ b/database/migrations/2020_05_16_165705_add_unique_constraint_to_tags.php @@ -0,0 +1,32 @@ +unique('name'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('tags', function (Blueprint $table) { + $table->dropUnique(['name']); + }); + } +}