47 lines
2.5 KiB
PHP
47 lines
2.5 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 Version20241114164216 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 tables_clients (tables_id INT NOT NULL, clients_id INT NOT NULL, PRIMARY KEY(tables_id, clients_id))');
|
|
$this->addSql('CREATE INDEX IDX_80F8906E85405FD2 ON tables_clients (tables_id)');
|
|
$this->addSql('CREATE INDEX IDX_80F8906EAB014612 ON tables_clients (clients_id)');
|
|
$this->addSql('ALTER TABLE tables_clients ADD CONSTRAINT FK_80F8906E85405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('ALTER TABLE tables_clients ADD CONSTRAINT FK_80F8906EAB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT fk_8190d6c6ab014612');
|
|
$this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT fk_8190d6c685405fd2');
|
|
$this->addSql('DROP TABLE clients_tables');
|
|
}
|
|
|
|
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('CREATE TABLE clients_tables (clients_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(clients_id, tables_id))');
|
|
$this->addSql('CREATE INDEX idx_8190d6c685405fd2 ON clients_tables (tables_id)');
|
|
$this->addSql('CREATE INDEX idx_8190d6c6ab014612 ON clients_tables (clients_id)');
|
|
$this->addSql('ALTER TABLE clients_tables ADD CONSTRAINT fk_8190d6c6ab014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('ALTER TABLE clients_tables ADD CONSTRAINT fk_8190d6c685405fd2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
|
|
$this->addSql('ALTER TABLE tables_clients DROP CONSTRAINT FK_80F8906E85405FD2');
|
|
$this->addSql('ALTER TABLE tables_clients DROP CONSTRAINT FK_80F8906EAB014612');
|
|
$this->addSql('DROP TABLE tables_clients');
|
|
}
|
|
}
|