summaryrefslogtreecommitdiff
path: root/db/migrations/2019_06_12_000000_fix_user_languages.php
blob: c7d1474c5610a9be87f85c88788523cdbbc535c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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")')
            ]);
    }
}