From e37219b1ca07b318d3426cfbc60cf6a1a503798a Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Thu, 29 Jun 2023 12:57:06 +0200 Subject: [PATCH] Fix migration rollback --- ...018_01_16_012910_create_activities_table.php | 2 ++ .../2021_07_04_101300_create_payments_table.php | 1 + .../2021_11_18_001427_create_courses_table.php | 1 + .../2021_11_18_215522_create_settings_table.php | 5 +++++ ...17_011021_create_groups_parent_id_column.php | 4 ++-- ..._203444_create_members_prevention_column.php | 8 ++++++++ ...3_create_users_email_verified_add_column.php | 3 +++ ..._10_05_171451_create_members_slug_column.php | 3 +++ ...00_create_memberships_has_promise_column.php | 3 +++ ...03644_create_subscription_children_table.php | 17 ++++++----------- 10 files changed, 34 insertions(+), 13 deletions(-) diff --git a/database/migrations/2018_01_16_012910_create_activities_table.php b/database/migrations/2018_01_16_012910_create_activities_table.php index ff370a1a..3a6b5dca 100644 --- a/database/migrations/2018_01_16_012910_create_activities_table.php +++ b/database/migrations/2018_01_16_012910_create_activities_table.php @@ -44,6 +44,8 @@ class CreateActivitiesTable extends Migration */ public function down() { + Schema::dropIfExists('activity_subactivity'); + Schema::dropIfExists('subactivities'); Schema::dropIfExists('activities'); } } diff --git a/database/migrations/2021_07_04_101300_create_payments_table.php b/database/migrations/2021_07_04_101300_create_payments_table.php index f111952f..6d03f558 100644 --- a/database/migrations/2021_07_04_101300_create_payments_table.php +++ b/database/migrations/2021_07_04_101300_create_payments_table.php @@ -44,5 +44,6 @@ class CreatePaymentsTable extends Migration public function down() { Schema::dropIfExists('payments'); + Schema::dropIfExists('statuses'); } } diff --git a/database/migrations/2021_11_18_001427_create_courses_table.php b/database/migrations/2021_11_18_001427_create_courses_table.php index 3a9b7af1..38ff4a6a 100644 --- a/database/migrations/2021_11_18_001427_create_courses_table.php +++ b/database/migrations/2021_11_18_001427_create_courses_table.php @@ -37,6 +37,7 @@ class CreateCoursesTable extends Migration */ public function down() { + Schema::dropIfExists('course_members'); Schema::dropIfExists('courses'); } } diff --git a/database/migrations/2021_11_18_215522_create_settings_table.php b/database/migrations/2021_11_18_215522_create_settings_table.php index c4cee231..54e5fd75 100644 --- a/database/migrations/2021_11_18_215522_create_settings_table.php +++ b/database/migrations/2021_11_18_215522_create_settings_table.php @@ -22,4 +22,9 @@ class CreateSettingsTable extends Migration $table->timestamps(); }); } + + public function down() + { + Schema::dropIfExists('settings'); + } } diff --git a/database/migrations/2022_02_17_011021_create_groups_parent_id_column.php b/database/migrations/2022_02_17_011021_create_groups_parent_id_column.php index edca1c7f..625acab3 100644 --- a/database/migrations/2022_02_17_011021_create_groups_parent_id_column.php +++ b/database/migrations/2022_02_17_011021_create_groups_parent_id_column.php @@ -26,8 +26,8 @@ class CreateGroupsParentIdColumn extends Migration public function down() { Schema::table('groups', function (Blueprint $table) { - $table->dropForeign(['group_id']); - $table->dropColumn('group_id'); + $table->dropForeign(['parent_id']); + $table->dropColumn('parent_id'); }); } } diff --git a/database/migrations/2022_04_28_203444_create_members_prevention_column.php b/database/migrations/2022_04_28_203444_create_members_prevention_column.php index ac8599f8..8c525565 100644 --- a/database/migrations/2022_04_28_203444_create_members_prevention_column.php +++ b/database/migrations/2022_04_28_203444_create_members_prevention_column.php @@ -32,6 +32,14 @@ return new class() extends Migration { public function down() { Schema::table('members', function (Blueprint $table) { + $table->dropColumn('ps_at'); + $table->dropColumn('more_ps_at'); + $table->dropColumn('without_education_at'); + $table->dropColumn('without_efz_at'); + $table->dropColumn('has_svk'); + $table->dropColumn('has_vk'); + $table->dropColumn('multiply_pv'); + $table->dropColumn('multiply_more_pv'); }); } }; diff --git a/database/migrations/2022_08_30_132503_create_users_email_verified_add_column.php b/database/migrations/2022_08_30_132503_create_users_email_verified_add_column.php index fe445974..f52d20cc 100644 --- a/database/migrations/2022_08_30_132503_create_users_email_verified_add_column.php +++ b/database/migrations/2022_08_30_132503_create_users_email_verified_add_column.php @@ -27,6 +27,9 @@ return new class() extends Migration { public function down() { Schema::table('users', function (Blueprint $table) { + $table->dropUnique(['email']); + $table->dropColumn('email_verified_at'); + $table->dropColumn('remember_token'); }); } }; diff --git a/database/migrations/2022_10_05_171451_create_members_slug_column.php b/database/migrations/2022_10_05_171451_create_members_slug_column.php index 4be42c61..efadaa84 100644 --- a/database/migrations/2022_10_05_171451_create_members_slug_column.php +++ b/database/migrations/2022_10_05_171451_create_members_slug_column.php @@ -24,5 +24,8 @@ return new class() extends Migration { */ public function down() { + Schema::table('members', function (Blueprint $table) { + $table->dropColumn('slug'); + }); } }; diff --git a/database/migrations/2022_12_11_192600_create_memberships_has_promise_column.php b/database/migrations/2022_12_11_192600_create_memberships_has_promise_column.php index d473d80a..f4c562ea 100644 --- a/database/migrations/2022_12_11_192600_create_memberships_has_promise_column.php +++ b/database/migrations/2022_12_11_192600_create_memberships_has_promise_column.php @@ -24,5 +24,8 @@ return new class() extends Migration { */ public function down() { + Schema::table('memberships', function (Blueprint $table) { + $table->dropColumn('promised_at'); + }); } }; diff --git a/database/migrations/2022_12_13_203644_create_subscription_children_table.php b/database/migrations/2022_12_13_203644_create_subscription_children_table.php index e390c5f8..9aa4236b 100644 --- a/database/migrations/2022_12_13_203644_create_subscription_children_table.php +++ b/database/migrations/2022_12_13_203644_create_subscription_children_table.php @@ -1,6 +1,5 @@ get(); - Schema::table('subscriptions', function (Blueprint $table) { $table->dropColumn('amount'); $table->boolean('split')->default(false); @@ -27,14 +24,6 @@ return new class() extends Migration { $table->string('name'); $table->unsignedInteger('amount'); }); - - foreach ($subscriptions as $subscription) { - SubscriptionChild::create([ - 'parent_id' => $subscription->id, - 'name' => 'name', - 'amount' => $subscription->amount, - ]); - } } /** @@ -44,5 +33,11 @@ return new class() extends Migration { */ public function down() { + Schema::dropIfExists('subscription_children'); + Schema::table('subscriptions', function (Blueprint $table) { + $table->unsignedInteger('amount'); + $table->dropColumn('split'); + $table->dropColumn('for_promise'); + }); } };