<?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 Version20220124055653 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 SEQUENCE store_attrs_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE store_work_hours_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE store_attrs (id INT NOT NULL, owner_id_id INT DEFAULT NULL, creater_id_id INT DEFAULT NULL, updater_id_id INT DEFAULT NULL, deleter_id_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, sort INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, active BOOLEAN NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_7DEE334C8FDDAB70 ON store_attrs (owner_id_id)');
$this->addSql('CREATE INDEX IDX_7DEE334C61979421 ON store_attrs (creater_id_id)');
$this->addSql('CREATE INDEX IDX_7DEE334C58C0AC79 ON store_attrs (updater_id_id)');
$this->addSql('CREATE INDEX IDX_7DEE334C16C208F5 ON store_attrs (deleter_id_id)');
$this->addSql('COMMENT ON COLUMN store_attrs.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN store_attrs.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN store_attrs.deleted_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE store_work_hours (id INT NOT NULL, owner_id_id INT DEFAULT NULL, creater_id_id INT DEFAULT NULL, updater_id_id INT DEFAULT NULL, deleter_id_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, sort INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, deleted_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, active BOOLEAN DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_8C089D4F8FDDAB70 ON store_work_hours (owner_id_id)');
$this->addSql('CREATE INDEX IDX_8C089D4F61979421 ON store_work_hours (creater_id_id)');
$this->addSql('CREATE INDEX IDX_8C089D4F58C0AC79 ON store_work_hours (updater_id_id)');
$this->addSql('CREATE INDEX IDX_8C089D4F16C208F5 ON store_work_hours (deleter_id_id)');
$this->addSql('COMMENT ON COLUMN store_work_hours.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN store_work_hours.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN store_work_hours.deleted_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE stores_store_work_hours (stores_id INT NOT NULL, store_work_hours_id INT NOT NULL, PRIMARY KEY(stores_id, store_work_hours_id))');
$this->addSql('CREATE INDEX IDX_5616B818D710F7F ON stores_store_work_hours (stores_id)');
$this->addSql('CREATE INDEX IDX_5616B81D7B37324 ON stores_store_work_hours (store_work_hours_id)');
$this->addSql('ALTER TABLE store_attrs ADD CONSTRAINT FK_7DEE334C8FDDAB70 FOREIGN KEY (owner_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_attrs ADD CONSTRAINT FK_7DEE334C61979421 FOREIGN KEY (creater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_attrs ADD CONSTRAINT FK_7DEE334C58C0AC79 FOREIGN KEY (updater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_attrs ADD CONSTRAINT FK_7DEE334C16C208F5 FOREIGN KEY (deleter_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_work_hours ADD CONSTRAINT FK_8C089D4F8FDDAB70 FOREIGN KEY (owner_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_work_hours ADD CONSTRAINT FK_8C089D4F61979421 FOREIGN KEY (creater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_work_hours ADD CONSTRAINT FK_8C089D4F58C0AC79 FOREIGN KEY (updater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE store_work_hours ADD CONSTRAINT FK_8C089D4F16C208F5 FOREIGN KEY (deleter_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE stores_store_work_hours ADD CONSTRAINT FK_5616B818D710F7F FOREIGN KEY (stores_id) REFERENCES "stores" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE stores_store_work_hours ADD CONSTRAINT FK_5616B81D7B37324 FOREIGN KEY (store_work_hours_id) REFERENCES store_work_hours (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('ALTER TABLE stores_store_work_hours DROP CONSTRAINT FK_5616B81D7B37324');
$this->addSql('DROP SEQUENCE store_attrs_id_seq CASCADE');
$this->addSql('DROP SEQUENCE store_work_hours_id_seq CASCADE');
$this->addSql('DROP TABLE store_attrs');
$this->addSql('DROP TABLE store_work_hours');
$this->addSql('DROP TABLE stores_store_work_hours');
}
}