<?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 Version20231218163734 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 TABLE v2_custom_user_percent (id UUID NOT NULL, reporting_period_id UUID DEFAULT NULL, ins_user_id INT NOT NULL, percent INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_38831D392832EB1C ON v2_custom_user_percent (reporting_period_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_38831D39F01A3F032832EB1C ON v2_custom_user_percent (ins_user_id, reporting_period_id)');
$this->addSql('COMMENT ON COLUMN v2_custom_user_percent.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_custom_user_percent.reporting_period_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_custom_user_percent.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_custom_user_percent.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE v2_income (id UUID NOT NULL, reporting_period_id UUID NOT NULL, wage_id UUID DEFAULT NULL, import_screen_name VARCHAR(255) NOT NULL, ins_account_id INT DEFAULT NULL, ins_resource_id INT NOT NULL, ins_model_id INT DEFAULT NULL, value DOUBLE PRECISION NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_F9AFA0DC2832EB1C ON v2_income (reporting_period_id)');
$this->addSql('CREATE INDEX IDX_F9AFA0DCC9E15D6A ON v2_income (wage_id)');
$this->addSql('COMMENT ON COLUMN v2_income.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_income.reporting_period_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_income.wage_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_income.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_income.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE v2_income_operator (id UUID NOT NULL, reporting_period_id UUID NOT NULL, wage_id UUID DEFAULT NULL, ins_operator_id INT NOT NULL, ins_model_id INT NOT NULL, total_value DOUBLE PRECISION DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_22665C162832EB1C ON v2_income_operator (reporting_period_id)');
$this->addSql('CREATE INDEX IDX_22665C16C9E15D6A ON v2_income_operator (wage_id)');
$this->addSql('COMMENT ON COLUMN v2_income_operator.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_income_operator.reporting_period_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_income_operator.wage_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_income_operator.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_income_operator.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE v2_reporting_period (id UUID NOT NULL, start_dt DATE NOT NULL, end_dt DATE NOT NULL, status INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6B3D3686CA2497B24AA4E439 ON v2_reporting_period (start_dt, end_dt)');
$this->addSql('COMMENT ON COLUMN v2_reporting_period.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_reporting_period.start_dt IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_reporting_period.end_dt IS \'(DC2Type:date_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_reporting_period.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE v2_wage (id UUID NOT NULL, reporting_period_id UUID NOT NULL, ins_user_id INT NOT NULL, ins_user_role INT NOT NULL, percent DOUBLE PRECISION NOT NULL, value DOUBLE PRECISION NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_49BC95562832EB1C ON v2_wage (reporting_period_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_49BC9556F01A3F032832EB1C ON v2_wage (ins_user_id, reporting_period_id)');
$this->addSql('COMMENT ON COLUMN v2_wage.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_wage.reporting_period_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_wage.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_wage.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE v2_custom_user_percent ADD CONSTRAINT FK_38831D392832EB1C FOREIGN KEY (reporting_period_id) REFERENCES v2_reporting_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_income ADD CONSTRAINT FK_F9AFA0DC2832EB1C FOREIGN KEY (reporting_period_id) REFERENCES v2_reporting_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_income ADD CONSTRAINT FK_F9AFA0DCC9E15D6A FOREIGN KEY (wage_id) REFERENCES v2_wage (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_income_operator ADD CONSTRAINT FK_22665C162832EB1C FOREIGN KEY (reporting_period_id) REFERENCES v2_reporting_period (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_income_operator ADD CONSTRAINT FK_22665C16C9E15D6A FOREIGN KEY (wage_id) REFERENCES v2_wage (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_wage ADD CONSTRAINT FK_49BC95562832EB1C FOREIGN KEY (reporting_period_id) REFERENCES v2_reporting_period (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('ALTER TABLE v2_custom_user_percent DROP CONSTRAINT FK_38831D392832EB1C');
$this->addSql('ALTER TABLE v2_income DROP CONSTRAINT FK_F9AFA0DC2832EB1C');
$this->addSql('ALTER TABLE v2_income_operator DROP CONSTRAINT FK_22665C162832EB1C');
$this->addSql('ALTER TABLE v2_wage DROP CONSTRAINT FK_49BC95562832EB1C');
$this->addSql('ALTER TABLE v2_income DROP CONSTRAINT FK_F9AFA0DCC9E15D6A');
$this->addSql('ALTER TABLE v2_income_operator DROP CONSTRAINT FK_22665C16C9E15D6A');
$this->addSql('DROP TABLE v2_custom_user_percent');
$this->addSql('DROP TABLE v2_income');
$this->addSql('DROP TABLE v2_income_operator');
$this->addSql('DROP TABLE v2_reporting_period');
$this->addSql('DROP TABLE v2_wage');
}
}