reordered migrations

This commit is contained in:
Daniël Klabbers 2019-09-28 21:02:45 +02:00
parent 3737ce8146
commit 58ab6052ad
4 changed files with 8 additions and 0 deletions

View File

@ -16,12 +16,15 @@ return [
'up' => function (Builder $schema) { 'up' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) { $schema->table('users', function (Blueprint $table) {
$table->boolean('disclose_online')->default(false); $table->boolean('disclose_online')->default(false);
$table->string('locale')->nullable();
}); });
}, },
'down' => function (Builder $schema) { 'down' => function (Builder $schema) {
$schema->table('users', function (Blueprint $table) { $schema->table('users', function (Blueprint $table) {
$table->dropColumn('disclose_online'); $table->dropColumn('disclose_online');
$table->dropColumn('locale');
}); });
} }
]; ];

View File

@ -27,6 +27,11 @@ return [
->where('id', $user->id) ->where('id', $user->id)
->update(['disclose_online' => (bool) $value]); ->update(['disclose_online' => (bool) $value]);
} }
if ($key === 'locale') {
$db->table('users')
->where('id', $user->id)
->update(['locale' => $value]);
}
if (preg_match('/^notify_(?<type>[^_]+)_(?<channel>.*)$/', $key, $matches)) { if (preg_match('/^notify_(?<type>[^_]+)_(?<channel>.*)$/', $key, $matches)) {
$db->table('notification_preferences') $db->table('notification_preferences')
->insert([ ->insert([