36 lines
1.3 KiB
PHP
36 lines
1.3 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 Version20260127191206 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 customer_tracking (id SERIAL NOT NULL, customer_id INT DEFAULT NULL, track_id VARCHAR(255) NOT NULL, create_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
|
||
|
|
$this->addSql('CREATE INDEX IDX_84B921339395C3F3 ON customer_tracking (customer_id)');
|
||
|
|
$this->addSql('ALTER TABLE customer_tracking ADD CONSTRAINT FK_84B921339395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (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 customer_tracking DROP CONSTRAINT FK_84B921339395C3F3');
|
||
|
|
$this->addSql('DROP TABLE customer_tracking');
|
||
|
|
}
|
||
|
|
}
|