36 lines
1.4 KiB
PHP
36 lines
1.4 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 Version20260404190626 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 website (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, name VARCHAR(255) NOT NULL, uuid VARCHAR(36) NOT NULL, type VARCHAR(20) NOT NULL, state VARCHAR(20) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, customer_id INT NOT NULL, PRIMARY KEY (id))');
|
||
|
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_476F5DE7D17F50A6 ON website (uuid)');
|
||
|
|
$this->addSql('CREATE INDEX IDX_476F5DE79395C3F3 ON website (customer_id)');
|
||
|
|
$this->addSql('ALTER TABLE website ADD CONSTRAINT FK_476F5DE79395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(Schema $schema): void
|
||
|
|
{
|
||
|
|
// this down() migration is auto-generated, please modify it to your needs
|
||
|
|
$this->addSql('ALTER TABLE website DROP CONSTRAINT FK_476F5DE79395C3F3');
|
||
|
|
$this->addSql('DROP TABLE website');
|
||
|
|
}
|
||
|
|
}
|