Pruebas de integracion con seeds
This commit is contained in:
43
app/resources/database/seeds/TipoUnidad.php
Normal file
43
app/resources/database/seeds/TipoUnidad.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Seed\AbstractSeed;
|
||||
|
||||
class TipoUnidad extends AbstractSeed
|
||||
{
|
||||
/**
|
||||
* Run Method.
|
||||
*
|
||||
* Write your database seeder using this method.
|
||||
*
|
||||
* More information on writing seeders is available here:
|
||||
* https://book.cakephp.org/phinx/0/en/seeding.html
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$this->execute('SET unique_checks=0; SET foreign_key_checks=0;');
|
||||
|
||||
$table = $this->table('tipo_unidad');
|
||||
$table->truncate();
|
||||
|
||||
$data = [
|
||||
[
|
||||
'descripcion' => 'departamento',
|
||||
'orden' => 0,
|
||||
],
|
||||
[
|
||||
'descripcion' => 'estacionamiento',
|
||||
'orden' => 1,
|
||||
],
|
||||
[
|
||||
'descripcion' => 'bodega',
|
||||
'orden' => 2,
|
||||
]
|
||||
];
|
||||
|
||||
$table->insert($data)->saveData();
|
||||
|
||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user