CdsConnector/migrations/Version20230119141248.php

44 lines
2.6 KiB
PHP
Raw Normal View History

2023-01-30 15:36:20 +01:00
<?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 Version20230119141248 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 hls_country (id INT AUTO_INCREMENT NOT NULL, short_name VARCHAR(255) NOT NULL, short_iso VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE orders (id INT AUTO_INCREMENT NOT NULL, order_id VARCHAR(255) NOT NULL, status INT NOT NULL, data LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE products (id INT AUTO_INCREMENT NOT NULL, shopware_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:guid)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE stock (id INT AUTO_INCREMENT NOT NULL, warehouse_id_id INT DEFAULT NULL, prod_id_id INT DEFAULT NULL, gtin VARCHAR(255) NOT NULL, stock INT NOT NULL, update_time DATETIME DEFAULT NULL, INDEX IDX_4B365660FE25E29A (warehouse_id_id), INDEX IDX_4B365660F91A0F34 (prod_id_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE warehouse (id INT AUTO_INCREMENT NOT NULL, priority INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE stock ADD CONSTRAINT FK_4B365660FE25E29A FOREIGN KEY (warehouse_id_id) REFERENCES warehouse (id)');
$this->addSql('ALTER TABLE stock ADD CONSTRAINT FK_4B365660F91A0F34 FOREIGN KEY (prod_id_id) REFERENCES products (id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE stock DROP FOREIGN KEY FK_4B365660FE25E29A');
$this->addSql('ALTER TABLE stock DROP FOREIGN KEY FK_4B365660F91A0F34');
$this->addSql('DROP TABLE hls_country');
$this->addSql('DROP TABLE orders');
$this->addSql('DROP TABLE products');
$this->addSql('DROP TABLE stock');
$this->addSql('DROP TABLE warehouse');
}
}