From ffadd3e78a99a2addee3584a5e112d723d9e37cc Mon Sep 17 00:00:00 2001 From: DariusIII Date: Sun, 28 Apr 2024 15:32:46 +0200 Subject: [PATCH] Add migrations that were missed for some reason --- ...9_151759_create_forum_table_categories.php | 35 +++++++++++++ ...5_19_152425_create_forum_table_threads.php | 39 +++++++++++++++ ..._05_19_152611_create_forum_table_posts.php | 37 ++++++++++++++ ...180344_create_forum_table_threads_read.php | 33 +++++++++++++ ...2_181406_update_forum_table_categories.php | 49 +++++++++++++++++++ ...7_22_181409_update_forum_table_threads.php | 31 ++++++++++++ ..._07_22_181417_update_forum_table_posts.php | 32 ++++++++++++ ...efaults_to_forum_table_threads_columns.php | 33 +++++++++++++ ..._111441_add_counts_to_categories_table.php | 33 +++++++++++++ ..._09_122706_add_counts_to_threads_table.php | 31 ++++++++++++ ..._10_134700_add_sequence_to_posts_table.php | 31 ++++++++++++ ...8_11_04_211718_update_categories_table.php | 35 +++++++++++++ ..._210904_update_forum_category_booleans.php | 34 +++++++++++++ ...9_09_07_230148_add_color_to_categories.php | 32 ++++++++++++ ...22_050710_add_thread_ids_to_categories.php | 34 +++++++++++++ ...20_03_22_055827_add_post_id_to_threads.php | 32 ++++++++++++ ...02_233754_add_first_post_id_to_threads.php | 32 ++++++++++++ .../2021_07_31_094750_add_fk_indices.php | 40 +++++++++++++++ 18 files changed, 623 insertions(+) create mode 100644 database/migrations/2014_05_19_151759_create_forum_table_categories.php create mode 100644 database/migrations/2014_05_19_152425_create_forum_table_threads.php create mode 100644 database/migrations/2014_05_19_152611_create_forum_table_posts.php create mode 100644 database/migrations/2015_04_14_180344_create_forum_table_threads_read.php create mode 100644 database/migrations/2015_07_22_181406_update_forum_table_categories.php create mode 100644 database/migrations/2015_07_22_181409_update_forum_table_threads.php create mode 100644 database/migrations/2015_07_22_181417_update_forum_table_posts.php create mode 100644 database/migrations/2016_05_24_114302_add_defaults_to_forum_table_threads_columns.php create mode 100644 database/migrations/2016_07_09_111441_add_counts_to_categories_table.php create mode 100644 database/migrations/2016_07_09_122706_add_counts_to_threads_table.php create mode 100644 database/migrations/2016_07_10_134700_add_sequence_to_posts_table.php create mode 100644 database/migrations/2018_11_04_211718_update_categories_table.php create mode 100644 database/migrations/2019_09_07_210904_update_forum_category_booleans.php create mode 100644 database/migrations/2019_09_07_230148_add_color_to_categories.php create mode 100644 database/migrations/2020_03_22_050710_add_thread_ids_to_categories.php create mode 100644 database/migrations/2020_03_22_055827_add_post_id_to_threads.php create mode 100644 database/migrations/2020_12_02_233754_add_first_post_id_to_threads.php create mode 100644 database/migrations/2021_07_31_094750_add_fk_indices.php diff --git a/database/migrations/2014_05_19_151759_create_forum_table_categories.php b/database/migrations/2014_05_19_151759_create_forum_table_categories.php new file mode 100644 index 000000000..4dc06b2cd --- /dev/null +++ b/database/migrations/2014_05_19_151759_create_forum_table_categories.php @@ -0,0 +1,35 @@ +increments('id'); + $table->integer('parent_category')->unsigned(); + $table->string('title'); + $table->string('subtitle'); + $table->integer('weight'); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('forum_categories'); + } +} diff --git a/database/migrations/2014_05_19_152425_create_forum_table_threads.php b/database/migrations/2014_05_19_152425_create_forum_table_threads.php new file mode 100644 index 000000000..d848cee39 --- /dev/null +++ b/database/migrations/2014_05_19_152425_create_forum_table_threads.php @@ -0,0 +1,39 @@ +increments('id'); + $table->integer('parent_category')->unsigned(); + $table->foreignIdFor(config('forum.integration.user_model'), 'author_id'); + $table->string('title'); + $table->boolean('pinned'); + $table->boolean('locked'); + + $table->timestamps(); + $table->softDeletes(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('forum_threads'); + } +} diff --git a/database/migrations/2014_05_19_152611_create_forum_table_posts.php b/database/migrations/2014_05_19_152611_create_forum_table_posts.php new file mode 100644 index 000000000..2995ed042 --- /dev/null +++ b/database/migrations/2014_05_19_152611_create_forum_table_posts.php @@ -0,0 +1,37 @@ +increments('id'); + $table->integer('parent_thread')->unsigned(); + $table->foreignIdFor(config('forum.integration.user_model'), 'author_id'); + $table->text('content'); + + $table->timestamps(); + $table->softDeletes(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('forum_posts'); + } +} diff --git a/database/migrations/2015_04_14_180344_create_forum_table_threads_read.php b/database/migrations/2015_04_14_180344_create_forum_table_threads_read.php new file mode 100644 index 000000000..74780f102 --- /dev/null +++ b/database/migrations/2015_04_14_180344_create_forum_table_threads_read.php @@ -0,0 +1,33 @@ +integer('thread_id')->unsigned(); + $table->foreignIdFor(config('forum.integration.user_model'), 'user_id'); + $table->timestamps(); + }); + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::drop('forum_threads_read'); + } +} diff --git a/database/migrations/2015_07_22_181406_update_forum_table_categories.php b/database/migrations/2015_07_22_181406_update_forum_table_categories.php new file mode 100644 index 000000000..e8ae2b2f1 --- /dev/null +++ b/database/migrations/2015_07_22_181406_update_forum_table_categories.php @@ -0,0 +1,49 @@ +renameColumn('parent_category', 'category_id'); + } + if (!Schema::hasColumn('forum_categories', 'description')) { + $table->renameColumn('subtitle', 'description'); + } + }); + + Schema::table('forum_categories', function (Blueprint $table) { + $table->integer('category_id')->default(0)->change(); + $table->string('description')->nullable()->change(); + $table->integer('weight')->default(0)->change(); + + $table->boolean('enable_threads')->default(0); + $table->boolean('private')->default(0); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_categories', function (Blueprint $table) { + $table->renameColumn('category_id', 'parent_category'); + $table->dropColumn(['created_at', 'updated_at', 'enable_threads', 'private']); + $table->renameColumn('description', 'subtitle'); + }); + } +} diff --git a/database/migrations/2015_07_22_181409_update_forum_table_threads.php b/database/migrations/2015_07_22_181409_update_forum_table_threads.php new file mode 100644 index 000000000..37e3096ef --- /dev/null +++ b/database/migrations/2015_07_22_181409_update_forum_table_threads.php @@ -0,0 +1,31 @@ +renameColumn('parent_category', 'category_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_threads', function (Blueprint $table) { + $table->renameColumn('category_id', 'parent_category'); + }); + } +} diff --git a/database/migrations/2015_07_22_181417_update_forum_table_posts.php b/database/migrations/2015_07_22_181417_update_forum_table_posts.php new file mode 100644 index 000000000..134152435 --- /dev/null +++ b/database/migrations/2015_07_22_181417_update_forum_table_posts.php @@ -0,0 +1,32 @@ +renameColumn('parent_thread', 'thread_id'); + $table->integer('post_id')->after('content')->unsigned()->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_posts', function (Blueprint $table) { + $table->renameColumn('thread_id', 'parent_thread'); + }); + } +} diff --git a/database/migrations/2016_05_24_114302_add_defaults_to_forum_table_threads_columns.php b/database/migrations/2016_05_24_114302_add_defaults_to_forum_table_threads_columns.php new file mode 100644 index 000000000..775417b82 --- /dev/null +++ b/database/migrations/2016_05_24_114302_add_defaults_to_forum_table_threads_columns.php @@ -0,0 +1,33 @@ +boolean('pinned')->nullable()->default(0)->change(); + $table->boolean('locked')->nullable()->default(0)->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_threads', function (Blueprint $table) { + $table->boolean('pinned')->nullable(false)->default(null)->change(); + $table->boolean('locked')->nullable(false)->default(null)->change(); + }); + } +} diff --git a/database/migrations/2016_07_09_111441_add_counts_to_categories_table.php b/database/migrations/2016_07_09_111441_add_counts_to_categories_table.php new file mode 100644 index 000000000..020fe0b26 --- /dev/null +++ b/database/migrations/2016_07_09_111441_add_counts_to_categories_table.php @@ -0,0 +1,33 @@ +integer('post_count')->after('enable_threads')->default(0); + $table->integer('thread_count')->after('enable_threads')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_categories', function (Blueprint $table) { + $table->dropColumn(['thread_count', 'post_count']); + }); + } +} diff --git a/database/migrations/2016_07_09_122706_add_counts_to_threads_table.php b/database/migrations/2016_07_09_122706_add_counts_to_threads_table.php new file mode 100644 index 000000000..1d2a25c50 --- /dev/null +++ b/database/migrations/2016_07_09_122706_add_counts_to_threads_table.php @@ -0,0 +1,31 @@ +integer('reply_count')->after('locked')->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_threads', function (Blueprint $table) { + $table->dropColumn('reply_count'); + }); + } +} diff --git a/database/migrations/2016_07_10_134700_add_sequence_to_posts_table.php b/database/migrations/2016_07_10_134700_add_sequence_to_posts_table.php new file mode 100644 index 000000000..04bf7a8a0 --- /dev/null +++ b/database/migrations/2016_07_10_134700_add_sequence_to_posts_table.php @@ -0,0 +1,31 @@ +integer('sequence')->after('post_id')->unsigned()->default(0); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_posts', function (Blueprint $table) { + $table->dropColumn('sequence'); + }); + } +} diff --git a/database/migrations/2018_11_04_211718_update_categories_table.php b/database/migrations/2018_11_04_211718_update_categories_table.php new file mode 100644 index 000000000..cf369086a --- /dev/null +++ b/database/migrations/2018_11_04_211718_update_categories_table.php @@ -0,0 +1,35 @@ +nestedSet(); + $table->dropColumn(['category_id', 'weight']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_categories', function (Blueprint $table) { + $table->dropNestedSet(); + $table->integer('category_id')->unsigned(); + $table->integer('weight'); + }); + } +} diff --git a/database/migrations/2019_09_07_210904_update_forum_category_booleans.php b/database/migrations/2019_09_07_210904_update_forum_category_booleans.php new file mode 100644 index 000000000..4e2b46fab --- /dev/null +++ b/database/migrations/2019_09_07_210904_update_forum_category_booleans.php @@ -0,0 +1,34 @@ +renameColumn('enable_threads', 'accepts_threads'); + $table->renameColumn('private', 'is_private'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_categories', function (Blueprint $table) { + $table->renameColumn('accepts_threads', 'enable_threads'); + $table->renameColumn('is_private', 'private'); + }); + } +} diff --git a/database/migrations/2019_09_07_230148_add_color_to_categories.php b/database/migrations/2019_09_07_230148_add_color_to_categories.php new file mode 100644 index 000000000..3dd1f3684 --- /dev/null +++ b/database/migrations/2019_09_07_230148_add_color_to_categories.php @@ -0,0 +1,32 @@ +string('color')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_categories', function (Blueprint $table) { + $table->dropColumn('color'); + }); + } +} diff --git a/database/migrations/2020_03_22_050710_add_thread_ids_to_categories.php b/database/migrations/2020_03_22_050710_add_thread_ids_to_categories.php new file mode 100644 index 000000000..678bd0d5d --- /dev/null +++ b/database/migrations/2020_03_22_050710_add_thread_ids_to_categories.php @@ -0,0 +1,34 @@ +integer('newest_thread_id')->after('accepts_threads')->unsigned()->nullable(); + $table->integer('latest_active_thread_id')->after('newest_thread_id')->unsigned()->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_categories', function (Blueprint $table) { + $table->dropColumn('newest_thread_id'); + $table->dropColumn('latest_active_thread_id'); + }); + } +} diff --git a/database/migrations/2020_03_22_055827_add_post_id_to_threads.php b/database/migrations/2020_03_22_055827_add_post_id_to_threads.php new file mode 100644 index 000000000..b5cb8b813 --- /dev/null +++ b/database/migrations/2020_03_22_055827_add_post_id_to_threads.php @@ -0,0 +1,32 @@ +integer('last_post_id')->after('locked')->unsigned()->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_threads', function (Blueprint $table) { + $table->dropColumn('last_post_id'); + }); + } +} diff --git a/database/migrations/2020_12_02_233754_add_first_post_id_to_threads.php b/database/migrations/2020_12_02_233754_add_first_post_id_to_threads.php new file mode 100644 index 000000000..75f844f87 --- /dev/null +++ b/database/migrations/2020_12_02_233754_add_first_post_id_to_threads.php @@ -0,0 +1,32 @@ +integer('first_post_id')->after('locked')->unsigned()->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_threads', function (Blueprint $table) { + $table->dropColumn('first_post_id'); + }); + } +} diff --git a/database/migrations/2021_07_31_094750_add_fk_indices.php b/database/migrations/2021_07_31_094750_add_fk_indices.php new file mode 100644 index 000000000..98053ac0e --- /dev/null +++ b/database/migrations/2021_07_31_094750_add_fk_indices.php @@ -0,0 +1,40 @@ +index('category_id'); + }); + + Schema::table('forum_posts', function (Blueprint $table) { + $table->index('thread_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forum_threads', function (Blueprint $table) { + $table->dropIndex('forum_threads_category_id_index'); + }); + + Schema::table('forum_posts', function (Blueprint $table) { + $table->dropIndex('forum_posts_thread_id_index'); + }); + } +}