CdsConnector/migrations/Version20220630134334.php
2022-07-01 15:31:34 +02:00

38 lines
1.6 KiB
PHP

<?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 Version20220630134334 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 stock (id INT AUTO_INCREMENT NOT NULL, warehouse_id_id INT DEFAULT NULL, product_id VARCHAR(255) NOT NULL, stock INT NOT NULL, update_time DATETIME DEFAULT NULL, INDEX IDX_4B365660FE25E29A (warehouse_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 orders CHANGE status status INT NOT NULL');
}
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('DROP TABLE stock');
$this->addSql('DROP TABLE warehouse');
$this->addSql('ALTER TABLE orders CHANGE status status INT DEFAULT NULL');
}
}