<?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 Version20220926090433 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 salary_period_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$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))');
$this->addSql('CREATE INDEX IDX_13FB5AC5A76ED395 ON salary_period (user_id)');
$this->addSql('ALTER TABLE salary_period ADD CONSTRAINT FK_13FB5AC5A76ED395 FOREIGN KEY (user_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE shift_periods ADD shift_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE shift_periods ADD CONSTRAINT FK_A46A4DBBB70BC0E FOREIGN KEY (shift_id) REFERENCES "shifts" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_A46A4DBBB70BC0E ON shift_periods (shift_id)');
}
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('DROP SEQUENCE salary_period_id_seq CASCADE');
$this->addSql('DROP TABLE salary_period');
$this->addSql('ALTER TABLE "shift_periods" DROP CONSTRAINT FK_A46A4DBBB70BC0E');
$this->addSql('DROP INDEX IDX_A46A4DBBB70BC0E');
$this->addSql('ALTER TABLE "shift_periods" DROP shift_id');
}
}