migrations/Version20220926090433.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 Version20220926090433 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('CREATE SEQUENCE salary_period_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19.         $this->addSql('CREATE TABLE salary_period (id INT NOT NULL, user_id INT DEFAULT NULL, month INT NOT NULL, year INT NOT NULL, PRIMARY KEY(id))');
  20.         $this->addSql('CREATE INDEX IDX_13FB5AC5A76ED395 ON salary_period (user_id)');
  21.         $this->addSql('ALTER TABLE salary_period ADD CONSTRAINT FK_13FB5AC5A76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  22.         $this->addSql('ALTER TABLE shift_periods ADD shift_id INT DEFAULT NULL');
  23.         $this->addSql('ALTER TABLE shift_periods ADD CONSTRAINT FK_A46A4DBBB70BC0E FOREIGN KEY (shift_id) REFERENCES "shifts" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24.         $this->addSql('CREATE INDEX IDX_A46A4DBBB70BC0E ON shift_periods (shift_id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('CREATE SCHEMA public');
  30.         $this->addSql('DROP SEQUENCE salary_period_id_seq CASCADE');
  31.         $this->addSql('DROP TABLE salary_period');
  32.         $this->addSql('ALTER TABLE "shift_periods" DROP CONSTRAINT FK_A46A4DBBB70BC0E');
  33.         $this->addSql('DROP INDEX IDX_A46A4DBBB70BC0E');
  34.         $this->addSql('ALTER TABLE "shift_periods" DROP shift_id');
  35.     }
  36. }