43 lines
2.1 KiB
PHP
43 lines
2.1 KiB
PHP
|
|
<?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 Version20260130095656 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 product_photos (id SERIAL NOT NULL, product_id INT DEFAULT NULL, image_name VARCHAR(255) DEFAULT NULL, image_size INT DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
|
||
|
|
$this->addSql('CREATE INDEX IDX_6A0AA17D4584665A ON product_photos (product_id)');
|
||
|
|
$this->addSql('COMMENT ON COLUMN product_photos.updated_at IS \'(DC2Type:datetime_immutable)\'');
|
||
|
|
$this->addSql('CREATE TABLE product_video (id SERIAL NOT NULL, product_id INT DEFAULT NULL, image_name VARCHAR(255) DEFAULT NULL, image_size INT DEFAULT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
|
||
|
|
$this->addSql('CREATE INDEX IDX_DD9BA1704584665A ON product_video (product_id)');
|
||
|
|
$this->addSql('COMMENT ON COLUMN product_video.updated_at IS \'(DC2Type:datetime_immutable)\'');
|
||
|
|
$this->addSql('ALTER TABLE product_photos ADD CONSTRAINT FK_6A0AA17D4584665A FOREIGN KEY (product_id) REFERENCES product (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||
|
|
$this->addSql('ALTER TABLE product_video ADD CONSTRAINT FK_DD9BA1704584665A FOREIGN KEY (product_id) REFERENCES product (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('CREATE SCHEMA public');
|
||
|
|
$this->addSql('ALTER TABLE product_photos DROP CONSTRAINT FK_6A0AA17D4584665A');
|
||
|
|
$this->addSql('ALTER TABLE product_video DROP CONSTRAINT FK_DD9BA1704584665A');
|
||
|
|
$this->addSql('DROP TABLE product_photos');
|
||
|
|
$this->addSql('DROP TABLE product_video');
|
||
|
|
}
|
||
|
|
}
|