<?php
declare(strict_types=1);
namespace CoreMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221012085725 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 crm_bundle__opportunity (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', context_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', customer_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', commercial_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', state_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', recommendation_type_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', recommendation_customer_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(255) DEFAULT NULL, description LONGTEXT DEFAULT NULL, document_link LONGTEXT DEFAULT NULL, deadline DATE DEFAULT NULL, presentation_date DATE DEFAULT NULL, installation_date DATE DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_CEF0F8C76B00C1CF (context_id), INDEX IDX_CEF0F8C79395C3F3 (customer_id), INDEX IDX_CEF0F8C77854071C (commercial_id), INDEX IDX_CEF0F8C75D83CC1 (state_id), INDEX IDX_CEF0F8C7982F853F (recommendation_type_id), INDEX IDX_CEF0F8C7C0F34BEC (recommendation_customer_id), INDEX IDX_CEF0F8C7B03A8386 (created_by_id), INDEX IDX_CEF0F8C7896DBBDE (updated_by_id), INDEX IDX_CEF0F8C7C76F1F52 (deleted_by_id), INDEX name (name), INDEX created_at (created_at), INDEX deleted_at (deleted_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE crm_bundle__opportunity_activity (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', opportunity_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', opportunity_document_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', opportunity_state_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', comment LONGTEXT DEFAULT NULL, meeting_date DATETIME DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_3D0068599A34590F (opportunity_id), INDEX IDX_3D006859C825429A (opportunity_document_id), INDEX IDX_3D0068592AFDDCD2 (opportunity_state_id), INDEX IDX_3D006859B03A8386 (created_by_id), INDEX IDX_3D006859896DBBDE (updated_by_id), INDEX IDX_3D006859C76F1F52 (deleted_by_id), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE crm_bundle__opportunity_document (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', opportunity_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', quotation_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', order_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', invoice_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', credit_note_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_491DEB759A34590F (opportunity_id), INDEX IDX_491DEB75B4EA4E60 (quotation_id), INDEX IDX_491DEB758D9F6D38 (order_id), INDEX IDX_491DEB752989F1FD (invoice_id), INDEX IDX_491DEB751C696F7A (credit_note_id), INDEX IDX_491DEB75B03A8386 (created_by_id), INDEX IDX_491DEB75896DBBDE (updated_by_id), INDEX IDX_491DEB75C76F1F52 (deleted_by_id), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE crm_bundle__opportunity_state (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(128) NOT NULL, color VARCHAR(7) NOT NULL, text_color VARCHAR(7) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, is_active TINYINT(1) DEFAULT 1 NOT NULL, is_default TINYINT(1) NOT NULL, INDEX IDX_4055A61AB03A8386 (created_by_id), INDEX IDX_4055A61A896DBBDE (updated_by_id), INDEX IDX_4055A61AC76F1F52 (deleted_by_id), INDEX name (name), INDEX color (color), INDEX text_color (text_color), INDEX is_active (is_active), INDEX is_default (is_default), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE crm_bundle__opportunity_state_translations (id INT AUTO_INCREMENT NOT NULL, object_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_122C1FEC232D562B (object_id), FULLTEXT INDEX content (content), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE crm_bundle__recommendation_type (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', created_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', updated_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', deleted_by_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', name VARCHAR(128) NOT NULL, has_customer TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, is_active TINYINT(1) DEFAULT 1 NOT NULL, INDEX IDX_ABB41E28B03A8386 (created_by_id), INDEX IDX_ABB41E28896DBBDE (updated_by_id), INDEX IDX_ABB41E28C76F1F52 (deleted_by_id), INDEX name (name), INDEX has_customer (has_customer), INDEX is_active (is_active), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE crm_bundle__recommendation_type_translations (id INT AUTO_INCREMENT NOT NULL, object_id BINARY(16) DEFAULT NULL COMMENT \'(DC2Type:uuid)\', locale VARCHAR(8) NOT NULL, field VARCHAR(32) NOT NULL, content LONGTEXT DEFAULT NULL, INDEX IDX_2E52E273232D562B (object_id), FULLTEXT INDEX content (content), UNIQUE INDEX lookup_unique_idx (locale, object_id, field), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C76B00C1CF FOREIGN KEY (context_id) REFERENCES context (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C79395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C77854071C FOREIGN KEY (commercial_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C75D83CC1 FOREIGN KEY (state_id) REFERENCES crm_bundle__opportunity_state (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C7982F853F FOREIGN KEY (recommendation_type_id) REFERENCES crm_bundle__recommendation_type (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C7C0F34BEC FOREIGN KEY (recommendation_customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C7B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C7896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity ADD CONSTRAINT FK_CEF0F8C7C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity ADD CONSTRAINT FK_3D0068599A34590F FOREIGN KEY (opportunity_id) REFERENCES crm_bundle__opportunity (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity ADD CONSTRAINT FK_3D006859C825429A FOREIGN KEY (opportunity_document_id) REFERENCES crm_bundle__opportunity_document (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity ADD CONSTRAINT FK_3D0068592AFDDCD2 FOREIGN KEY (opportunity_state_id) REFERENCES crm_bundle__opportunity_state (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity ADD CONSTRAINT FK_3D006859B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity ADD CONSTRAINT FK_3D006859896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity ADD CONSTRAINT FK_3D006859C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB759A34590F FOREIGN KEY (opportunity_id) REFERENCES crm_bundle__opportunity (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB75B4EA4E60 FOREIGN KEY (quotation_id) REFERENCES sales_bundle__quotation (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB758D9F6D38 FOREIGN KEY (order_id) REFERENCES sales_bundle__order (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB752989F1FD FOREIGN KEY (invoice_id) REFERENCES sales_bundle__invoice (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB751C696F7A FOREIGN KEY (credit_note_id) REFERENCES sales_bundle__credit_note (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB75B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB75896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document ADD CONSTRAINT FK_491DEB75C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state ADD CONSTRAINT FK_4055A61AB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state ADD CONSTRAINT FK_4055A61A896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state ADD CONSTRAINT FK_4055A61AC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state_translations ADD CONSTRAINT FK_122C1FEC232D562B FOREIGN KEY (object_id) REFERENCES crm_bundle__opportunity_state (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type ADD CONSTRAINT FK_ABB41E28B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type ADD CONSTRAINT FK_ABB41E28896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type ADD CONSTRAINT FK_ABB41E28C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type_translations ADD CONSTRAINT FK_2E52E273232D562B FOREIGN KEY (object_id) REFERENCES crm_bundle__recommendation_type (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C76B00C1CF');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C79395C3F3');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C77854071C');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C75D83CC1');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C7982F853F');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C7C0F34BEC');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C7B03A8386');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C7896DBBDE');
$this->addSql('ALTER TABLE crm_bundle__opportunity DROP FOREIGN KEY FK_CEF0F8C7C76F1F52');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity DROP FOREIGN KEY FK_3D0068599A34590F');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity DROP FOREIGN KEY FK_3D006859C825429A');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity DROP FOREIGN KEY FK_3D0068592AFDDCD2');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity DROP FOREIGN KEY FK_3D006859B03A8386');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity DROP FOREIGN KEY FK_3D006859896DBBDE');
$this->addSql('ALTER TABLE crm_bundle__opportunity_activity DROP FOREIGN KEY FK_3D006859C76F1F52');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB759A34590F');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB75B4EA4E60');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB758D9F6D38');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB752989F1FD');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB751C696F7A');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB75B03A8386');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB75896DBBDE');
$this->addSql('ALTER TABLE crm_bundle__opportunity_document DROP FOREIGN KEY FK_491DEB75C76F1F52');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state DROP FOREIGN KEY FK_4055A61AB03A8386');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state DROP FOREIGN KEY FK_4055A61A896DBBDE');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state DROP FOREIGN KEY FK_4055A61AC76F1F52');
$this->addSql('ALTER TABLE crm_bundle__opportunity_state_translations DROP FOREIGN KEY FK_122C1FEC232D562B');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type DROP FOREIGN KEY FK_ABB41E28B03A8386');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type DROP FOREIGN KEY FK_ABB41E28896DBBDE');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type DROP FOREIGN KEY FK_ABB41E28C76F1F52');
$this->addSql('ALTER TABLE crm_bundle__recommendation_type_translations DROP FOREIGN KEY FK_2E52E273232D562B');
$this->addSql('DROP TABLE crm_bundle__opportunity');
$this->addSql('DROP TABLE crm_bundle__opportunity_activity');
$this->addSql('DROP TABLE crm_bundle__opportunity_document');
$this->addSql('DROP TABLE crm_bundle__opportunity_state');
$this->addSql('DROP TABLE crm_bundle__opportunity_state_translations');
$this->addSql('DROP TABLE crm_bundle__recommendation_type');
$this->addSql('DROP TABLE crm_bundle__recommendation_type_translations');
}
}