2019-07-08 01:47:01 +02:00
|
|
|
<?php
|
|
|
|
|
2023-02-03 20:41:59 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-07-08 01:47:01 +02:00
|
|
|
namespace Engelsystem\Migrations;
|
|
|
|
|
|
|
|
use Engelsystem\Database\Migration\Migration;
|
|
|
|
|
|
|
|
class FixUserLanguages extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migration
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function up(): void
|
2019-07-08 01:47:01 +02:00
|
|
|
{
|
|
|
|
$connection = $this->schema->getConnection();
|
|
|
|
$connection
|
|
|
|
->table('users_settings')
|
|
|
|
->update([
|
2023-02-05 18:03:00 +01:00
|
|
|
'language' => $connection->raw('REPLACE(language, ".UTF-8", "")'),
|
2019-07-08 01:47:01 +02:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migration
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function down(): void
|
2019-07-08 01:47:01 +02:00
|
|
|
{
|
|
|
|
$connection = $this->schema->getConnection();
|
|
|
|
$connection
|
|
|
|
->table('users_settings')
|
|
|
|
->update([
|
2023-02-05 18:03:00 +01:00
|
|
|
'language' => $connection->raw('CONCAT(language, ".UTF-8")'),
|
2019-07-08 01:47:01 +02:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|