migrations/Version20230929143957.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20230929143957 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE inventory_location (id INT AUTO_INCREMENT NOT NULL, type SMALLINT NOT NULL, name VARCHAR(255) NOT NULL, enabled TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE inventory_order (id INT AUTO_INCREMENT NOT NULL, applicant_id INT NOT NULL, preparator_id INT NOT NULL, delivery_address_id INT NOT NULL, client_id INT NOT NULL, invoice_id INT DEFAULT NULL, status SMALLINT NOT NULL, num VARCHAR(255) NOT NULL, delay DATE NOT NULL, notes LONGTEXT DEFAULT NULL, INDEX IDX_29B5389897139001 (applicant_id), INDEX IDX_29B53898F17005AA (preparator_id), INDEX IDX_29B53898EBF23851 (delivery_address_id), INDEX IDX_29B5389819EB6921 (client_id), INDEX IDX_29B538982989F1FD (invoice_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE inventory_order_row (id INT AUTO_INCREMENT NOT NULL, inventory_order_id INT NOT NULL, product_id INT NOT NULL, stock_id INT NOT NULL, qty NUMERIC(10, 2) NOT NULL, INDEX IDX_40D750D339D5D7A9 (inventory_order_id), INDEX IDX_40D750D34584665A (product_id), INDEX IDX_40D750D3DCD6110 (stock_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE inventory_stock (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, delivery_address_id INT NOT NULL, inventory_location_type10_id INT DEFAULT NULL, inventory_location_type20_id INT DEFAULT NULL, inventory_location_type30_id INT DEFAULT NULL, qty NUMERIC(10, 2) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_97AAFD604584665A (product_id), INDEX IDX_97AAFD60EBF23851 (delivery_address_id), INDEX IDX_97AAFD6068F3FD8F (inventory_location_type10_id), INDEX IDX_97AAFD602F53875F (inventory_location_type20_id), INDEX IDX_97AAFD601233AEEF (inventory_location_type30_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE inventory_stock_movement (id INT AUTO_INCREMENT NOT NULL, collaborator_id INT NOT NULL, out_from_id INT DEFAULT NULL, destination_id INT DEFAULT NULL, type SMALLINT NOT NULL, date DATE NOT NULL, notes LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_1A8FA7330098C8C (collaborator_id), INDEX IDX_1A8FA737C20E808 (out_from_id), INDEX IDX_1A8FA73816C6140 (destination_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('CREATE TABLE inventory_stock_movement_row (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, inventory_stock_movement_id INT NOT NULL, qty NUMERIC(10, 2) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_195B10224584665A (product_id), INDEX IDX_195B10226A831D5 (inventory_stock_movement_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  24.         $this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B5389897139001 FOREIGN KEY (applicant_id) REFERENCES collaborator (id)');
  25.         $this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B53898F17005AA FOREIGN KEY (preparator_id) REFERENCES collaborator (id)');
  26.         $this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B53898EBF23851 FOREIGN KEY (delivery_address_id) REFERENCES delivery_address (id)');
  27.         $this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B5389819EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
  28.         $this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B538982989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');
  29.         $this->addSql('ALTER TABLE inventory_order_row ADD CONSTRAINT FK_40D750D339D5D7A9 FOREIGN KEY (inventory_order_id) REFERENCES inventory_order (id)');
  30.         $this->addSql('ALTER TABLE inventory_order_row ADD CONSTRAINT FK_40D750D34584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  31.         $this->addSql('ALTER TABLE inventory_order_row ADD CONSTRAINT FK_40D750D3DCD6110 FOREIGN KEY (stock_id) REFERENCES inventory_stock (id)');
  32.         $this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD604584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  33.         $this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD60EBF23851 FOREIGN KEY (delivery_address_id) REFERENCES delivery_address (id)');
  34.         $this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD6068F3FD8F FOREIGN KEY (inventory_location_type10_id) REFERENCES inventory_location (id)');
  35.         $this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD602F53875F FOREIGN KEY (inventory_location_type20_id) REFERENCES inventory_location (id)');
  36.         $this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD601233AEEF FOREIGN KEY (inventory_location_type30_id) REFERENCES inventory_location (id)');
  37.         $this->addSql('ALTER TABLE inventory_stock_movement ADD CONSTRAINT FK_1A8FA7330098C8C FOREIGN KEY (collaborator_id) REFERENCES collaborator (id)');
  38.         $this->addSql('ALTER TABLE inventory_stock_movement ADD CONSTRAINT FK_1A8FA737C20E808 FOREIGN KEY (out_from_id) REFERENCES delivery_address (id)');
  39.         $this->addSql('ALTER TABLE inventory_stock_movement ADD CONSTRAINT FK_1A8FA73816C6140 FOREIGN KEY (destination_id) REFERENCES delivery_address (id)');
  40.         $this->addSql('ALTER TABLE inventory_stock_movement_row ADD CONSTRAINT FK_195B10224584665A FOREIGN KEY (product_id) REFERENCES product (id)');
  41.         $this->addSql('ALTER TABLE inventory_stock_movement_row ADD CONSTRAINT FK_195B10226A831D5 FOREIGN KEY (inventory_stock_movement_id) REFERENCES inventory_stock_movement (id)');
  42.         $this->addSql('ALTER TABLE supplier_shipping ADD is_dispatched TINYINT(1) NOT NULL');
  43.     }
  44.     public function down(Schema $schema): void
  45.     {
  46.         // this down() migration is auto-generated, please modify it to your needs
  47.         $this->addSql('ALTER TABLE inventory_stock DROP FOREIGN KEY FK_97AAFD6068F3FD8F');
  48.         $this->addSql('ALTER TABLE inventory_stock DROP FOREIGN KEY FK_97AAFD602F53875F');
  49.         $this->addSql('ALTER TABLE inventory_stock DROP FOREIGN KEY FK_97AAFD601233AEEF');
  50.         $this->addSql('ALTER TABLE inventory_order_row DROP FOREIGN KEY FK_40D750D339D5D7A9');
  51.         $this->addSql('ALTER TABLE inventory_order_row DROP FOREIGN KEY FK_40D750D3DCD6110');
  52.         $this->addSql('ALTER TABLE inventory_stock_movement_row DROP FOREIGN KEY FK_195B10226A831D5');
  53.         $this->addSql('DROP TABLE inventory_location');
  54.         $this->addSql('DROP TABLE inventory_order');
  55.         $this->addSql('DROP TABLE inventory_order_row');
  56.         $this->addSql('DROP TABLE inventory_stock');
  57.         $this->addSql('DROP TABLE inventory_stock_movement');
  58.         $this->addSql('DROP TABLE inventory_stock_movement_row');
  59.         $this->addSql('ALTER TABLE supplier_shipping DROP is_dispatched');
  60.     }
  61. }