<?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 Version20220124054136 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add stores';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE "stores" (id SERIAL NOT NULL, creater_id_id INT DEFAULT NULL, updater_id_id INT DEFAULT NULL, deleter_id_id INT DEFAULT NULL, owner_id_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, address VARCHAR(1024) DEFAULT NULL, latitude DOUBLE PRECISION DEFAULT NULL, longitude DOUBLE PRECISION DEFAULT NULL, sort INT DEFAULT 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_D5907CCC61979421 ON "stores" (creater_id_id)');
$this->addSql('CREATE INDEX IDX_D5907CCC58C0AC79 ON "stores" (updater_id_id)');
$this->addSql('CREATE INDEX IDX_D5907CCC16C208F5 ON "stores" (deleter_id_id)');
$this->addSql('CREATE INDEX IDX_D5907CCC8FDDAB70 ON "stores" (owner_id_id)');
$this->addSql('COMMENT ON COLUMN "stores".created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN "stores".updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN "stores".deleted_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC61979421 FOREIGN KEY (creater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC58C0AC79 FOREIGN KEY (updater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC16C208F5 FOREIGN KEY (deleter_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC8FDDAB70 FOREIGN KEY (owner_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE "stores"');
}
}