<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230929143957 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$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');
$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');
$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');
$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');
$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');
$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');
$this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B5389897139001 FOREIGN KEY (applicant_id) REFERENCES collaborator (id)');
$this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B53898F17005AA FOREIGN KEY (preparator_id) REFERENCES collaborator (id)');
$this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B53898EBF23851 FOREIGN KEY (delivery_address_id) REFERENCES delivery_address (id)');
$this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B5389819EB6921 FOREIGN KEY (client_id) REFERENCES client (id)');
$this->addSql('ALTER TABLE inventory_order ADD CONSTRAINT FK_29B538982989F1FD FOREIGN KEY (invoice_id) REFERENCES invoice (id)');
$this->addSql('ALTER TABLE inventory_order_row ADD CONSTRAINT FK_40D750D339D5D7A9 FOREIGN KEY (inventory_order_id) REFERENCES inventory_order (id)');
$this->addSql('ALTER TABLE inventory_order_row ADD CONSTRAINT FK_40D750D34584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE inventory_order_row ADD CONSTRAINT FK_40D750D3DCD6110 FOREIGN KEY (stock_id) REFERENCES inventory_stock (id)');
$this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD604584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD60EBF23851 FOREIGN KEY (delivery_address_id) REFERENCES delivery_address (id)');
$this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD6068F3FD8F FOREIGN KEY (inventory_location_type10_id) REFERENCES inventory_location (id)');
$this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD602F53875F FOREIGN KEY (inventory_location_type20_id) REFERENCES inventory_location (id)');
$this->addSql('ALTER TABLE inventory_stock ADD CONSTRAINT FK_97AAFD601233AEEF FOREIGN KEY (inventory_location_type30_id) REFERENCES inventory_location (id)');
$this->addSql('ALTER TABLE inventory_stock_movement ADD CONSTRAINT FK_1A8FA7330098C8C FOREIGN KEY (collaborator_id) REFERENCES collaborator (id)');
$this->addSql('ALTER TABLE inventory_stock_movement ADD CONSTRAINT FK_1A8FA737C20E808 FOREIGN KEY (out_from_id) REFERENCES delivery_address (id)');
$this->addSql('ALTER TABLE inventory_stock_movement ADD CONSTRAINT FK_1A8FA73816C6140 FOREIGN KEY (destination_id) REFERENCES delivery_address (id)');
$this->addSql('ALTER TABLE inventory_stock_movement_row ADD CONSTRAINT FK_195B10224584665A FOREIGN KEY (product_id) REFERENCES product (id)');
$this->addSql('ALTER TABLE inventory_stock_movement_row ADD CONSTRAINT FK_195B10226A831D5 FOREIGN KEY (inventory_stock_movement_id) REFERENCES inventory_stock_movement (id)');
$this->addSql('ALTER TABLE supplier_shipping ADD is_dispatched TINYINT(1) NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE inventory_stock DROP FOREIGN KEY FK_97AAFD6068F3FD8F');
$this->addSql('ALTER TABLE inventory_stock DROP FOREIGN KEY FK_97AAFD602F53875F');
$this->addSql('ALTER TABLE inventory_stock DROP FOREIGN KEY FK_97AAFD601233AEEF');
$this->addSql('ALTER TABLE inventory_order_row DROP FOREIGN KEY FK_40D750D339D5D7A9');
$this->addSql('ALTER TABLE inventory_order_row DROP FOREIGN KEY FK_40D750D3DCD6110');
$this->addSql('ALTER TABLE inventory_stock_movement_row DROP FOREIGN KEY FK_195B10226A831D5');
$this->addSql('DROP TABLE inventory_location');
$this->addSql('DROP TABLE inventory_order');
$this->addSql('DROP TABLE inventory_order_row');
$this->addSql('DROP TABLE inventory_stock');
$this->addSql('DROP TABLE inventory_stock_movement');
$this->addSql('DROP TABLE inventory_stock_movement_row');
$this->addSql('ALTER TABLE supplier_shipping DROP is_dispatched');
}
}