<?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 Version20210706051743 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('ALTER TABLE invoices_comments_attachments DROP CONSTRAINT IF EXISTS fk_17d73d2b1b50d8d');
$this->addSql('DROP SEQUENCE invoices_chats_comments_id_seq CASCADE');
$this->addSql('CREATE SEQUENCE "invoices_comments_id_seq" INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE "invoices_comments" (id INT NOT NULL, invoice_id INT DEFAULT NULL, owner_id INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, message TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_4190C1882989F1FD ON "invoices_comments" (invoice_id)');
$this->addSql('CREATE INDEX IDX_4190C1887E3C61F9 ON "invoices_comments" (owner_id)');
$this->addSql('ALTER TABLE "invoices_comments" ADD CONSTRAINT FK_4190C1882989F1FD FOREIGN KEY (invoice_id) REFERENCES "invoices" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE "invoices_comments" ADD CONSTRAINT FK_4190C1887E3C61F9 FOREIGN KEY (owner_id) REFERENCES "users" (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE invoices_chats_comments');
$this->addSql('ALTER TABLE invoices_comments_attachments DROP CONSTRAINT IF EXISTS FK_17D73D2B1B50D8D');
$this->addSql('ALTER TABLE invoices_comments_attachments ADD CONSTRAINT FK_17D73D2B1B50D8D FOREIGN KEY (invoice_comment_id) REFERENCES "invoices_comments" (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('ALTER TABLE "invoices_comments_attachments" DROP CONSTRAINT FK_17D73D2B1B50D8D');
$this->addSql('DROP SEQUENCE "invoices_comments_id_seq" CASCADE');
$this->addSql('CREATE SEQUENCE invoices_chats_comments_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE invoices_chats_comments (id INT NOT NULL, invoice_id INT DEFAULT NULL, owner_id INT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, message TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX idx_2a5278187e3c61f9 ON invoices_chats_comments (owner_id)');
$this->addSql('CREATE INDEX idx_2a5278182989f1fd ON invoices_chats_comments (invoice_id)');
$this->addSql('ALTER TABLE invoices_chats_comments ADD CONSTRAINT fk_2a5278182989f1fd FOREIGN KEY (invoice_id) REFERENCES invoices (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE invoices_chats_comments ADD CONSTRAINT fk_2a5278187e3c61f9 FOREIGN KEY (owner_id) REFERENCES users (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('DROP TABLE "invoices_comments"');
$this->addSql('ALTER TABLE "invoices_comments_attachments" DROP CONSTRAINT fk_17d73d2b1b50d8d');
$this->addSql('ALTER TABLE "invoices_comments_attachments" ADD CONSTRAINT fk_17d73d2b1b50d8d FOREIGN KEY (invoice_comment_id) REFERENCES invoices_chats_comments (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
}
}