summaryrefslogtreecommitdiff
path: root/db/migrations/2019_06_12_000000_fix_user_languages.php
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations/2019_06_12_000000_fix_user_languages.php')
-rw-r--r--db/migrations/2019_06_12_000000_fix_user_languages.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/db/migrations/2019_06_12_000000_fix_user_languages.php b/db/migrations/2019_06_12_000000_fix_user_languages.php
new file mode 100644
index 00000000..c7d1474c
--- /dev/null
+++ b/db/migrations/2019_06_12_000000_fix_user_languages.php
@@ -0,0 +1,34 @@
+<?php
+
+namespace Engelsystem\Migrations;
+
+use Engelsystem\Database\Migration\Migration;
+
+class FixUserLanguages extends Migration
+{
+ /**
+ * Run the migration
+ */
+ public function up()
+ {
+ $connection = $this->schema->getConnection();
+ $connection
+ ->table('users_settings')
+ ->update([
+ 'language' => $connection->raw('REPLACE(language, ".UTF-8", "")')
+ ]);
+ }
+
+ /**
+ * Reverse the migration
+ */
+ public function down()
+ {
+ $connection = $this->schema->getConnection();
+ $connection
+ ->table('users_settings')
+ ->update([
+ 'language' => $connection->raw('CONCAT(language, ".UTF-8")')
+ ]);
+ }
+}