migrations/Version20220824070957.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 Version20220824070957 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  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('DROP SEQUENCE shift_period_id_seq CASCADE');
  19.         $this->addSql('CREATE SEQUENCE "shift_periods_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
  20.         $this->addSql('CREATE TABLE "shift_periods" (id INT NOT NULL, user_id INT DEFAULT NULL, type VARCHAR(50) NOT NULL, extra VARCHAR(50) DEFAULT NULL, day INT NOT NULL, month INT NOT NULL, year INT NOT NULL, PRIMARY KEY(id))');
  21.         $this->addSql('CREATE INDEX IDX_A46A4DBA76ED395 ON "shift_periods" (user_id)');
  22.         $this->addSql('ALTER TABLE "shift_periods" ADD CONSTRAINT FK_A46A4DBA76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  23.         $this->addSql('DROP TABLE shift_period');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('CREATE SCHEMA public');
  29.         $this->addSql('DROP SEQUENCE "shift_periods_id_seq" CASCADE');
  30.         $this->addSql('CREATE SEQUENCE shift_period_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  31.         $this->addSql('CREATE TABLE shift_period (id INT NOT NULL, user_id INT DEFAULT NULL, type VARCHAR(50) NOT NULL, extra VARCHAR(50) DEFAULT NULL, day INT NOT NULL, month INT NOT NULL, year INT NOT NULL, PRIMARY KEY(id))');
  32.         $this->addSql('CREATE INDEX idx_49608cdba76ed395 ON shift_period (user_id)');
  33.         $this->addSql('ALTER TABLE shift_period ADD CONSTRAINT fk_49608cdba76ed395 FOREIGN KEY (user_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  34.         $this->addSql('DROP TABLE "shift_periods"');
  35.     }
  36. }