<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20240523125856 extends AbstractMigration
{
public function getDescription(): string
{
return 'Added entity {CustomerAppointment, CustomerDelivery, PlatformReception, PlatformShipping, OrderCustomerAppointment, OrderCustomerDelivery, OrderPlatformReception, OrderPlatformShipping}, fields Order.{identifiantColibri, cashOnDelivery}';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE customer_appointment (id INT AUTO_INCREMENT NOT NULL, ps_id_order_state INT NULL, code VARCHAR(10) NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE customer_delivery (id INT AUTO_INCREMENT NOT NULL, ps_id_order_state INT NULL, code VARCHAR(10) NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE platform_reception (id INT AUTO_INCREMENT NOT NULL, ps_id_order_state INT NULL, code VARCHAR(10) NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE platform_shipping (id INT AUTO_INCREMENT NOT NULL, ps_id_order_state INT NULL, code VARCHAR(10) NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE order_customer_appointment (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, customer_appointment_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_43B785648D9F6D38 (order_id), INDEX IDX_43B785647CD80733 (customer_appointment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE order_customer_delivery (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, customer_delivery_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_F27E5648D9F6D38 (order_id), INDEX IDX_F27E56411584229 (customer_delivery_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE order_platform_reception (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, platform_reception_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_5F476F518D9F6D38 (order_id), INDEX IDX_5F476F5134E94E1F (platform_reception_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE order_platform_shipping (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, platform_shipping_id INT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BC0F5D6D8D9F6D38 (order_id), INDEX IDX_BC0F5D6D720F55F (platform_shipping_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE order_customer_appointment ADD CONSTRAINT FK_43B785648D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE order_customer_appointment ADD CONSTRAINT FK_43B785647CD80733 FOREIGN KEY (customer_appointment_id) REFERENCES customer_appointment (id)');
$this->addSql('ALTER TABLE order_customer_delivery ADD CONSTRAINT FK_F27E5648D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE order_customer_delivery ADD CONSTRAINT FK_F27E56411584229 FOREIGN KEY (customer_delivery_id) REFERENCES customer_delivery (id)');
$this->addSql('ALTER TABLE order_platform_reception ADD CONSTRAINT FK_5F476F518D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE order_platform_reception ADD CONSTRAINT FK_5F476F5134E94E1F FOREIGN KEY (platform_reception_id) REFERENCES platform_reception (id)');
$this->addSql('ALTER TABLE order_platform_shipping ADD CONSTRAINT FK_BC0F5D6D8D9F6D38 FOREIGN KEY (order_id) REFERENCES `order` (id)');
$this->addSql('ALTER TABLE order_platform_shipping ADD CONSTRAINT FK_BC0F5D6D720F55F FOREIGN KEY (platform_shipping_id) REFERENCES platform_shipping (id)');
$this->addSql('ALTER TABLE `order` ADD identifiant_colibri INT DEFAULT NULL, ADD cash_on_delivery DOUBLE PRECISION DEFAULT NULL');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE order_customer_appointment DROP FOREIGN KEY FK_43B785648D9F6D38');
$this->addSql('ALTER TABLE order_customer_appointment DROP FOREIGN KEY FK_43B785647CD80733');
$this->addSql('ALTER TABLE order_customer_delivery DROP FOREIGN KEY FK_F27E5648D9F6D38');
$this->addSql('ALTER TABLE order_customer_delivery DROP FOREIGN KEY FK_F27E56411584229');
$this->addSql('ALTER TABLE order_platform_reception DROP FOREIGN KEY FK_5F476F518D9F6D38');
$this->addSql('ALTER TABLE order_platform_reception DROP FOREIGN KEY FK_5F476F5134E94E1F');
$this->addSql('ALTER TABLE order_platform_shipping DROP FOREIGN KEY FK_BC0F5D6D8D9F6D38');
$this->addSql('ALTER TABLE order_platform_shipping DROP FOREIGN KEY FK_BC0F5D6D720F55F');
$this->addSql('DROP TABLE customer_appointment');
$this->addSql('DROP TABLE customer_delivery');
$this->addSql('DROP TABLE platform_reception');
$this->addSql('DROP TABLE platform_shipping');
$this->addSql('DROP TABLE order_customer_appointment');
$this->addSql('DROP TABLE order_customer_delivery');
$this->addSql('DROP TABLE order_platform_reception');
$this->addSql('DROP TABLE order_platform_shipping');
$this->addSql('ALTER TABLE `order` DROP identifiant_colibri, DROP cash_on_delivery');
}
}