Cambio a migraciones de reservation
This commit is contained in:
@ -23,9 +23,11 @@ final class CreateReservation extends AbstractMigration
|
|||||||
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
||||||
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
||||||
|
|
||||||
$this->table('reservation')
|
$this->table('reservations')
|
||||||
|
->addColumn('project_id', 'integer', ['signed' => false, 'null' => false])
|
||||||
->addColumn('buyer_rut', 'integer', ['signed' => false, 'null' => false])
|
->addColumn('buyer_rut', 'integer', ['signed' => false, 'null' => false])
|
||||||
->addColumn('date', 'date', ['null' => false])
|
->addColumn('date', 'date', ['null' => false])
|
||||||
|
->addForeignKey('project_id', 'proyecto', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->addForeignKey('buyer_rut', 'personas', 'rut', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('buyer_rut', 'personas', 'rut', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
use Phinx\Migration\AbstractMigration;
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
final class CreateReservationDatas extends AbstractMigration
|
final class CreateReservationDetails extends AbstractMigration
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Change Method.
|
* Change Method.
|
||||||
@ -23,11 +23,13 @@ final class CreateReservationDatas extends AbstractMigration
|
|||||||
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
$this->execute("ALTER DATABASE CHARACTER SET 'utf8mb4';");
|
||||||
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
$this->execute("ALTER DATABASE COLLATE='utf8mb4_general_ci';");
|
||||||
|
|
||||||
$this->table('reservation_data')
|
$this->table('reservation_details')
|
||||||
->addColumn('reservation_id', 'integer', ['signed' => false, 'null' => false])
|
->addColumn('reservation_id', 'integer', ['signed' => false, 'null' => false])
|
||||||
->addColumn('type', 'integer', ['length' => 1, 'signed' => false, 'null' => false])
|
->addColumn('type', 'integer', ['length' => 1, 'signed' => false, 'null' => false])
|
||||||
->addColumn('reference_id', 'integer', ['signed' => false, 'null' => false])
|
->addColumn('reference_id', 'integer', ['signed' => false, 'null' => false])
|
||||||
->addColumn('value', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => false, 'default' => 0.00, 'null' => true])
|
->addColumn('value', 'decimal', ['precision' => 10, 'scale' => 2, 'signed' => false, 'default' => null, 'null' => true])
|
||||||
|
->addForeignKey('reservation_id', 'reservations', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
|
->addIndex(['reservation_id', 'type', 'reference_id'], ['unique' => true, 'name' => 'idx_reservation_details'])
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
@ -27,7 +27,7 @@ final class CreateReservationStates extends AbstractMigration
|
|||||||
->addColumn('reservation_id', 'integer', ['signed' => false, 'null' => false])
|
->addColumn('reservation_id', 'integer', ['signed' => false, 'null' => false])
|
||||||
->addColumn('date', 'date', ['null' => false])
|
->addColumn('date', 'date', ['null' => false])
|
||||||
->addColumn('type', 'integer', ['length' => 3, 'null' => false, 'default' => 0])
|
->addColumn('type', 'integer', ['length' => 3, 'null' => false, 'default' => 0])
|
||||||
->addForeignKey('reservation_id', 'reservation', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
->addForeignKey('reservation_id', 'reservations', 'id', ['delete' => 'cascade', 'update' => 'cascade'])
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
$this->execute('SET unique_checks=1; SET foreign_key_checks=1;');
|
||||||
|
Reference in New Issue
Block a user