You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
engelsystem/db/migrations/2022_04_07_000000_rename_gr...

48 lines
1.2 KiB
PHTML

3 years ago
<?php
namespace Engelsystem\Migrations;
use Engelsystem\Database\Migration\Migration;
class RenameGroups extends Migration
{
const GROUPS = [
[-10, '1-Gast', '1-Besucher*in'],
[-20, '2-Engel', '2-Helfer*in'],
[-40, '3-Shift Coordinator', '3-Schicht-Koordinator*in'],
[-50, '4-Team Coordinator', '4-Team-Koordinator*in'],
[-60, '5-Bürokrat', '5-Bürokrat*in'],
[-70, '6-Developer', '6-Entwickler*in'],
];
/**
* Run the migration
*/
public function up()
{
$connection = $this->schema->getConnection();
foreach (GROUPS as [$id, $old, $new]) {
$connection->update(
'UPDATE `Groups` SET `Name` = ? WHERE `UID` = ?',
[$new, $id]
);
}
}
/**
* Reverse the migration
*/
public function down()
{
$connection = $this->schema->getConnection();
foreach (GROUPS as [$id, $old, $new]) {
$connection->update(
'UPDATE `Groups` SET `Name` = ? WHERE `UID` = ?',
[$old, $id]
);
}
}
}