From 58ab6052adabbe075387aad9f0b703ebebd26f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Sat, 28 Sep 2019 21:02:45 +0200 Subject: [PATCH] reordered migrations --- ...9_09_28_222800_create_notification_preferences_table.php} | 0 ..._09_28_222800_create_users_table_preferences_columns.php} | 3 +++ ...09_28_222801_migrate_users_table_preferences_columns.php} | 5 +++++ ...p => 2019_09_28_222810_change_users_drop_preferences.php} | 0 4 files changed, 8 insertions(+) rename migrations/{2018_01_30_222800_create_notification_preferences_table.php => 2019_09_28_222800_create_notification_preferences_table.php} (100%) rename migrations/{2018_01_30_222800_create_users_table_preferences_columns.php => 2019_09_28_222800_create_users_table_preferences_columns.php} (87%) rename migrations/{2018_01_30_222801_migrate_users_table_preferences_columns.php => 2019_09_28_222801_migrate_users_table_preferences_columns.php} (87%) rename migrations/{2019_07_09_212000_change_users_drop_preferences.php => 2019_09_28_222810_change_users_drop_preferences.php} (100%) diff --git a/migrations/2018_01_30_222800_create_notification_preferences_table.php b/migrations/2019_09_28_222800_create_notification_preferences_table.php similarity index 100% rename from migrations/2018_01_30_222800_create_notification_preferences_table.php rename to migrations/2019_09_28_222800_create_notification_preferences_table.php diff --git a/migrations/2018_01_30_222800_create_users_table_preferences_columns.php b/migrations/2019_09_28_222800_create_users_table_preferences_columns.php similarity index 87% rename from migrations/2018_01_30_222800_create_users_table_preferences_columns.php rename to migrations/2019_09_28_222800_create_users_table_preferences_columns.php index 6fa9b5c93..15ad82a6e 100644 --- a/migrations/2018_01_30_222800_create_users_table_preferences_columns.php +++ b/migrations/2019_09_28_222800_create_users_table_preferences_columns.php @@ -16,12 +16,15 @@ return [ 'up' => function (Builder $schema) { $schema->table('users', function (Blueprint $table) { $table->boolean('disclose_online')->default(false); + $table->string('locale')->nullable(); + }); }, 'down' => function (Builder $schema) { $schema->table('users', function (Blueprint $table) { $table->dropColumn('disclose_online'); + $table->dropColumn('locale'); }); } ]; diff --git a/migrations/2018_01_30_222801_migrate_users_table_preferences_columns.php b/migrations/2019_09_28_222801_migrate_users_table_preferences_columns.php similarity index 87% rename from migrations/2018_01_30_222801_migrate_users_table_preferences_columns.php rename to migrations/2019_09_28_222801_migrate_users_table_preferences_columns.php index f59e89d40..ae6078138 100644 --- a/migrations/2018_01_30_222801_migrate_users_table_preferences_columns.php +++ b/migrations/2019_09_28_222801_migrate_users_table_preferences_columns.php @@ -27,6 +27,11 @@ return [ ->where('id', $user->id) ->update(['disclose_online' => (bool) $value]); } + if ($key === 'locale') { + $db->table('users') + ->where('id', $user->id) + ->update(['locale' => $value]); + } if (preg_match('/^notify_(?[^_]+)_(?.*)$/', $key, $matches)) { $db->table('notification_preferences') ->insert([ diff --git a/migrations/2019_07_09_212000_change_users_drop_preferences.php b/migrations/2019_09_28_222810_change_users_drop_preferences.php similarity index 100% rename from migrations/2019_07_09_212000_change_users_drop_preferences.php rename to migrations/2019_09_28_222810_change_users_drop_preferences.php