feat: add migration for award_type, award tables and actor.awards_imported
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
32
migrations/Version20260401000001.php
Normal file
32
migrations/Version20260401000001.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
final class Version20260401000001 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add award_type, award tables and actor.awards_imported column';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('CREATE TABLE award_type (id SERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, pattern VARCHAR(255) NOT NULL)');
|
||||||
|
$this->addSql('CREATE TABLE award (id SERIAL PRIMARY KEY, award_type_id INT NOT NULL, actor_id INT NOT NULL, name VARCHAR(255) NOT NULL, year INT DEFAULT NULL, CONSTRAINT fk_award_award_type FOREIGN KEY (award_type_id) REFERENCES award_type (id), CONSTRAINT fk_award_actor FOREIGN KEY (actor_id) REFERENCES actor (id))');
|
||||||
|
$this->addSql('CREATE INDEX idx_award_award_type ON award (award_type_id)');
|
||||||
|
$this->addSql('CREATE INDEX idx_award_actor ON award (actor_id)');
|
||||||
|
$this->addSql('ALTER TABLE actor ADD awards_imported BOOLEAN NOT NULL DEFAULT false');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP TABLE award');
|
||||||
|
$this->addSql('DROP TABLE award_type');
|
||||||
|
$this->addSql('ALTER TABLE actor DROP COLUMN awards_imported');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user