Version20250113095919.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7. * Auto-generated Migration: Please modify to your needs!
  8. */
  9. final class Version20250113095919 extends AbstractMigration
  10. {
  11. public function getDescription(): string
  12. {
  13. return '';
  14. }
  15. public function up(Schema $schema): void
  16. {
  17. // this up() migration is auto-generated, please modify it to your needs
  18. $this->addSql('CREATE SEQUENCE common_list_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
  19. $this->addSql('CREATE TABLE common_list (id INT NOT NULL, film_id INT NOT NULL, added_by_id INT NOT NULL, date_added DATE NOT NULL, PRIMARY KEY(id))');
  20. $this->addSql('CREATE INDEX IDX_F450E089567F5183 ON common_list (film_id)');
  21. $this->addSql('CREATE INDEX IDX_F450E08955B127A4 ON common_list (added_by_id)');
  22. $this->addSql('COMMENT ON COLUMN common_list.date_added IS \'(DC2Type:date_immutable)\'');
  23. $this->addSql('ALTER TABLE common_list ADD CONSTRAINT FK_F450E089567F5183 FOREIGN KEY (film_id) REFERENCES film (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  24. $this->addSql('ALTER TABLE common_list ADD CONSTRAINT FK_F450E08955B127A4 FOREIGN KEY (added_by_id) REFERENCES "user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  25. }
  26. public function down(Schema $schema): void
  27. {
  28. // this down() migration is auto-generated, please modify it to your needs
  29. $this->addSql('DROP SEQUENCE common_list_id_seq CASCADE');
  30. $this->addSql('ALTER TABLE common_list DROP CONSTRAINT FK_F450E089567F5183');
  31. $this->addSql('ALTER TABLE common_list DROP CONSTRAINT FK_F450E08955B127A4');
  32. $this->addSql('DROP TABLE common_list');
  33. }
  34. }