Migrations and seeds
This commit is contained in:
42
app/resources/database/seeds/20141101080115_roles_seeder.php
Normal file
42
app/resources/database/seeds/20141101080115_roles_seeder.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Phinx\Seed\AbstractSeed;
|
||||
|
||||
class RolesSeeder extends AbstractSeed
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$data = [
|
||||
[
|
||||
'id' => 1,
|
||||
'description' => 'guest',
|
||||
'level' => 0,
|
||||
'inherits' => 0,
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'description' => 'administrador',
|
||||
'level' => 99,
|
||||
'inherits' => 3,
|
||||
],
|
||||
[
|
||||
'id' => 3,
|
||||
'description' => 'operador',
|
||||
'level' => 50,
|
||||
'inherits' => 4,
|
||||
],
|
||||
[
|
||||
'id' => 4,
|
||||
'description' => 'usuario',
|
||||
'level' => 1,
|
||||
'inherits' => 1,
|
||||
],
|
||||
];
|
||||
|
||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
||||
$this->table('roles')
|
||||
->insert($data)
|
||||
->saveData();
|
||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user