From 1db0220c20024170094e6e79c4497002a29f2ab6 Mon Sep 17 00:00:00 2001 From: Repflez Date: Sun, 29 Oct 2023 11:33:33 -0700 Subject: [PATCH] feat: add title id table for communities --- ...29_190449_add_community_title_id_table.php | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 database/2023_10_29_190449_add_community_title_id_table.php diff --git a/database/2023_10_29_190449_add_community_title_id_table.php b/database/2023_10_29_190449_add_community_title_id_table.php new file mode 100644 index 0000000..dab0c02 --- /dev/null +++ b/database/2023_10_29_190449_add_community_title_id_table.php @@ -0,0 +1,45 @@ +create('community_title_ids', function (Blueprint $table) { + $table->integer('community_id')->unsigned()->index(); + $table->string('title_id')->unique(); + + $table->foreign('community_id')->references('id')->on('communities')->cascadeOnDelete(); + }); + + $schema->table('communities', function (Blueprint $table) { + $table->dropColumn('title_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + $schema = DB::getSchemaBuilder(); + + $schema->drop('community_title_ids'); + + $schema->table('communities', function (Blueprint $table) { + $table->bigInteger('title_id')->after('id'); + }); + } +} \ No newline at end of file