Rename groups
parent
0419e7b217
commit
c0f19eb2ff
@ -0,0 +1,47 @@
|
||||
<?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]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue