<?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 Version20211226060651 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 SEQUENCE feedback_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE intercom_user_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE request_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE subscription_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE feedback (id INT NOT NULL, intercom_user_id INT DEFAULT NULL, feedback_id VARCHAR(255) NOT NULL, creation_date TIMESTAMP(0) WITH TIME ZONE NOT NULL, email VARCHAR(255) NOT NULL, message TEXT NOT NULL, name VARCHAR(255) NOT NULL, phone VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, search TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_D22944587D50FB54 ON feedback (intercom_user_id)');
$this->addSql('CREATE TABLE intercom_user (id INT NOT NULL, dealer_reader_id INT DEFAULT NULL, subscription_id INT DEFAULT NULL, user_id VARCHAR(255) NOT NULL, registration_id INT NOT NULL, onboarding BOOLEAN NOT NULL, phone VARCHAR(255) NOT NULL, search TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_6175FAAB5A5792B1 ON intercom_user (dealer_reader_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6175FAAB9A1887DC ON intercom_user (subscription_id)');
$this->addSql('CREATE TABLE request (id INT NOT NULL, intercom_user_id INT DEFAULT NULL, feedback_id INT DEFAULT NULL, description TEXT NOT NULL, status VARCHAR(255) NOT NULL, comment TEXT NOT NULL, search TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_3B978F9F7D50FB54 ON request (intercom_user_id)');
$this->addSql('CREATE INDEX IDX_3B978F9FD249A887 ON request (feedback_id)');
$this->addSql('CREATE TABLE subscription (id INT NOT NULL, subscription_id VARCHAR(255) NOT NULL, valid BOOLEAN NOT NULL, start_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, valid_until TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, search TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('ALTER TABLE feedback ADD CONSTRAINT FK_D22944587D50FB54 FOREIGN KEY (intercom_user_id) REFERENCES intercom_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE intercom_user ADD CONSTRAINT FK_6175FAAB5A5792B1 FOREIGN KEY (dealer_reader_id) REFERENCES dealer_reader (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE intercom_user ADD CONSTRAINT FK_6175FAAB9A1887DC FOREIGN KEY (subscription_id) REFERENCES subscription (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE request ADD CONSTRAINT FK_3B978F9F7D50FB54 FOREIGN KEY (intercom_user_id) REFERENCES intercom_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE request ADD CONSTRAINT FK_3B978F9FD249A887 FOREIGN KEY (feedback_id) REFERENCES feedback (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 request DROP CONSTRAINT FK_3B978F9FD249A887');
$this->addSql('ALTER TABLE feedback DROP CONSTRAINT FK_D22944587D50FB54');
$this->addSql('ALTER TABLE request DROP CONSTRAINT FK_3B978F9F7D50FB54');
$this->addSql('ALTER TABLE intercom_user DROP CONSTRAINT FK_6175FAAB9A1887DC');
$this->addSql('DROP SEQUENCE feedback_id_seq CASCADE');
$this->addSql('DROP SEQUENCE intercom_user_id_seq CASCADE');
$this->addSql('DROP SEQUENCE request_id_seq CASCADE');
$this->addSql('DROP SEQUENCE subscription_id_seq CASCADE');
$this->addSql('DROP TABLE feedback');
$this->addSql('DROP TABLE intercom_user');
$this->addSql('DROP TABLE request');
$this->addSql('DROP TABLE subscription');
}
}