<?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 Version20240304094117 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_transaction (id UUID NOT NULL, wage_id UUID NOT NULL, status SMALLINT DEFAULT 1 NOT NULL, value DOUBLE PRECISION NOT NULL, ins_payment_information_id INT NOT NULL, history_title VARCHAR(100) NOT NULL, payment_information JSON NOT NULL, received_at TIMESTAMP(0) WITHOUT TIME ZONE 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_F36CA810C9E15D6A ON v2_transaction (wage_id)');
$this->addSql('COMMENT ON COLUMN v2_transaction.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_transaction.wage_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_transaction.received_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_transaction.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('COMMENT ON COLUMN v2_transaction.updated_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('CREATE TABLE v2_wage_parts (id UUID NOT NULL, wage_id UUID NOT NULL, ins_model_id INT DEFAULT NULL, percent DOUBLE PRECISION NOT NULL, value DOUBLE PRECISION NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_8A64F85C9E15D6A ON v2_wage_parts (wage_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_8A64F85C9E15D6A604EF57A ON v2_wage_parts (wage_id, ins_model_id)');
$this->addSql('COMMENT ON COLUMN v2_wage_parts.id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_wage_parts.wage_id IS \'(DC2Type:uuid)\'');
$this->addSql('COMMENT ON COLUMN v2_wage_parts.created_at IS \'(DC2Type:datetime_immutable)\'');
$this->addSql('ALTER TABLE v2_transaction ADD CONSTRAINT FK_F36CA810C9E15D6A FOREIGN KEY (wage_id) REFERENCES v2_wage (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_wage_parts ADD CONSTRAINT FK_8A64F85C9E15D6A FOREIGN KEY (wage_id) REFERENCES v2_wage (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE v2_user_percent DROP is_custom');
$this->addSql('ALTER INDEX idx_38831d392832eb1c RENAME TO IDX_D55937B82832EB1C');
$this->addSql('ALTER INDEX uniq_38831d39f01a3f03604ef57a2832eb1c RENAME TO UNIQ_D55937B8F01A3F03604EF57A2832EB1C');
$this->addSql('ALTER TABLE v2_wage ALTER percent DROP NOT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE v2_transaction');
$this->addSql('DROP TABLE v2_wage_parts');
$this->addSql('ALTER TABLE v2_user_percent ADD is_custom BOOLEAN DEFAULT false NOT NULL');
$this->addSql('ALTER INDEX uniq_d55937b8f01a3f03604ef57a2832eb1c RENAME TO uniq_38831d39f01a3f03604ef57a2832eb1c');
$this->addSql('ALTER INDEX idx_d55937b82832eb1c RENAME TO idx_38831d392832eb1c');
$this->addSql('ALTER TABLE v2_wage ALTER percent SET NOT NULL');
}
}