migrations/Version20220124054136.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220124054136 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Add stores';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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))');
  19.         $this->addSql('CREATE INDEX IDX_D5907CCC61979421 ON "stores" (creater_id_id)');
  20.         $this->addSql('CREATE INDEX IDX_D5907CCC58C0AC79 ON "stores" (updater_id_id)');
  21.         $this->addSql('CREATE INDEX IDX_D5907CCC16C208F5 ON "stores" (deleter_id_id)');
  22.         $this->addSql('CREATE INDEX IDX_D5907CCC8FDDAB70 ON "stores" (owner_id_id)');
  23.         $this->addSql('COMMENT ON COLUMN "stores".created_at IS \'(DC2Type:datetime_immutable)\'');
  24.         $this->addSql('COMMENT ON COLUMN "stores".updated_at IS \'(DC2Type:datetime_immutable)\'');
  25.         $this->addSql('COMMENT ON COLUMN "stores".deleted_at IS \'(DC2Type:datetime_immutable)\'');
  26.         $this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC61979421 FOREIGN KEY (creater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  27.         $this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC58C0AC79 FOREIGN KEY (updater_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  28.         $this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC16C208F5 FOREIGN KEY (deleter_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('ALTER TABLE "stores" ADD CONSTRAINT FK_D5907CCC8FDDAB70 FOREIGN KEY (owner_id_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('DROP TABLE "stores"');
  35.     }
  36. }