<?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 Version20250402160843 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 lifting (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', vessel_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', operator_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', contract_id CHAR(36) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', lifting_number VARCHAR(191) NOT NULL, laycan_start DATETIME NOT NULL, laycan_end DATETIME NOT NULL, cost VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_63005026E6D3A46B (lifting_number), INDEX IDX_6300502614AF1953 (vessel_id), INDEX IDX_63005026584598A3 (operator_id), INDEX IDX_630050262576E0FD (contract_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE lifting ADD CONSTRAINT FK_6300502614AF1953 FOREIGN KEY (vessel_id) REFERENCES vessel (id)');
$this->addSql('ALTER TABLE lifting ADD CONSTRAINT FK_63005026584598A3 FOREIGN KEY (operator_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE lifting ADD CONSTRAINT FK_630050262576E0FD FOREIGN KEY (contract_id) REFERENCES contract (id)');
$this->addSql('ALTER TABLE contract ADD liftings_min INT DEFAULT NULL, ADD liftings_max INT DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE lifting DROP FOREIGN KEY FK_6300502614AF1953');
$this->addSql('ALTER TABLE lifting DROP FOREIGN KEY FK_63005026584598A3');
$this->addSql('ALTER TABLE lifting DROP FOREIGN KEY FK_630050262576E0FD');
$this->addSql('DROP TABLE lifting');
$this->addSql('ALTER TABLE contract DROP liftings_min, DROP liftings_max');
}
}