Groups: Added Welcome Angel
This commit is contained in:
parent
e9726982fd
commit
8c630a2148
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Engelsystem\Migrations;
|
||||||
|
|
||||||
|
use Engelsystem\Database\Migration\Migration;
|
||||||
|
|
||||||
|
class CreateWelcomeAngelPermissionsGroup extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migration
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if (!$this->schema->hasTable('Groups')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = $this->schema->getConnection();
|
||||||
|
|
||||||
|
$db
|
||||||
|
->table('Groups')
|
||||||
|
->insert([
|
||||||
|
'UID' => -25,
|
||||||
|
'Name' => 'Welcome Angel',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$privilege = $db->table('Privileges')
|
||||||
|
->where('name', 'admin_arrive')
|
||||||
|
->first();
|
||||||
|
|
||||||
|
$db->table('GroupPrivileges')
|
||||||
|
->insert([
|
||||||
|
'group_id' => -25,
|
||||||
|
'privilege_id' => $privilege->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migration
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if (!$this->schema->hasTable('Groups')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->schema->getConnection()
|
||||||
|
->table('Groups')
|
||||||
|
->where('UID', -25)
|
||||||
|
->delete();
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,6 +38,7 @@ trait HasDatabase
|
||||||
->table('migrations')
|
->table('migrations')
|
||||||
->insert(
|
->insert(
|
||||||
[
|
[
|
||||||
|
// Migrations that can be skipped as they only use legacy tables
|
||||||
['migration' => '2018_01_01_000001_import_install_sql'],
|
['migration' => '2018_01_01_000001_import_install_sql'],
|
||||||
['migration' => '2018_01_01_000002_import_update_sql'],
|
['migration' => '2018_01_01_000002_import_update_sql'],
|
||||||
['migration' => '2018_01_01_000003_fix_old_tables'],
|
['migration' => '2018_01_01_000003_fix_old_tables'],
|
||||||
|
@ -46,6 +47,7 @@ trait HasDatabase
|
||||||
['migration' => '2018_12_27_000000_fix_missing_arrival_dates'],
|
['migration' => '2018_12_27_000000_fix_missing_arrival_dates'],
|
||||||
['migration' => '2019_09_07_000000_migrate_admin_schedule_permissions'],
|
['migration' => '2019_09_07_000000_migrate_admin_schedule_permissions'],
|
||||||
['migration' => '2020_04_07_000000_change_mysql_database_encoding_to_utf8mb4'],
|
['migration' => '2020_04_07_000000_change_mysql_database_encoding_to_utf8mb4'],
|
||||||
|
['migration' => '2020_09_12_000000_create_welcome_angel_permissions_group'],
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue