<?php
declare(strict_types=1);
namespace OvhSmsBundleMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20221206154636 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE ovh_sms_bundle__mailing_list (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(255) 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_F0956ED1B03A8386 (created_by_id), INDEX IDX_F0956ED1896DBBDE (updated_by_id), INDEX IDX_F0956ED1C76F1F52 (deleted_by_id), 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 ovh_sms_bundle__mailing_list_customer (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', mailing_list_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', customer_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)\', phone VARCHAR(32) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_C1866C182C7EF3E4 (mailing_list_id), INDEX IDX_C1866C189395C3F3 (customer_id), INDEX IDX_C1866C18B03A8386 (created_by_id), INDEX IDX_C1866C18896DBBDE (updated_by_id), INDEX IDX_C1866C18C76F1F52 (deleted_by_id), INDEX phone (phone), INDEX deleted_at (deleted_at), INDEX created_at (created_at), INDEX updated_at (updated_at), UNIQUE INDEX customer_unique (mailing_list_id, customer_id, phone, deleted_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE ovh_sms_bundle__mailing_list_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_91F51D54232D562B (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 ovh_sms_bundle__sms (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', customer_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)\', phone VARCHAR(32) NOT NULL, message VARCHAR(255) NOT NULL, state VARCHAR(32) NOT NULL, sending_date DATETIME DEFAULT NULL, marketing TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_29AC49AF9395C3F3 (customer_id), INDEX IDX_29AC49AFB03A8386 (created_by_id), INDEX IDX_29AC49AF896DBBDE (updated_by_id), INDEX IDX_29AC49AFC76F1F52 (deleted_by_id), INDEX phone (phone), INDEX state (state), INDEX sending_date (sending_date), INDEX marketing (marketing), 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('ALTER TABLE ovh_sms_bundle__mailing_list ADD CONSTRAINT FK_F0956ED1B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list ADD CONSTRAINT FK_F0956ED1896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list ADD CONSTRAINT FK_F0956ED1C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer ADD CONSTRAINT FK_C1866C182C7EF3E4 FOREIGN KEY (mailing_list_id) REFERENCES ovh_sms_bundle__mailing_list (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer ADD CONSTRAINT FK_C1866C189395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer ADD CONSTRAINT FK_C1866C18B03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer ADD CONSTRAINT FK_C1866C18896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer ADD CONSTRAINT FK_C1866C18C76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_translations ADD CONSTRAINT FK_91F51D54232D562B FOREIGN KEY (object_id) REFERENCES ovh_sms_bundle__mailing_list (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms ADD CONSTRAINT FK_29AC49AF9395C3F3 FOREIGN KEY (customer_id) REFERENCES customers_bundle__customer (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms ADD CONSTRAINT FK_29AC49AFB03A8386 FOREIGN KEY (created_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms ADD CONSTRAINT FK_29AC49AF896DBBDE FOREIGN KEY (updated_by_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms ADD CONSTRAINT FK_29AC49AFC76F1F52 FOREIGN KEY (deleted_by_id) REFERENCES user (id)');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list DROP FOREIGN KEY FK_F0956ED1B03A8386');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list DROP FOREIGN KEY FK_F0956ED1896DBBDE');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list DROP FOREIGN KEY FK_F0956ED1C76F1F52');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer DROP FOREIGN KEY FK_C1866C182C7EF3E4');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer DROP FOREIGN KEY FK_C1866C189395C3F3');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer DROP FOREIGN KEY FK_C1866C18B03A8386');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer DROP FOREIGN KEY FK_C1866C18896DBBDE');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_customer DROP FOREIGN KEY FK_C1866C18C76F1F52');
$this->addSql('ALTER TABLE ovh_sms_bundle__mailing_list_translations DROP FOREIGN KEY FK_91F51D54232D562B');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms DROP FOREIGN KEY FK_29AC49AF9395C3F3');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms DROP FOREIGN KEY FK_29AC49AFB03A8386');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms DROP FOREIGN KEY FK_29AC49AF896DBBDE');
$this->addSql('ALTER TABLE ovh_sms_bundle__sms DROP FOREIGN KEY FK_29AC49AFC76F1F52');
$this->addSql('DROP TABLE ovh_sms_bundle__mailing_list');
$this->addSql('DROP TABLE ovh_sms_bundle__mailing_list_customer');
$this->addSql('DROP TABLE ovh_sms_bundle__mailing_list_translations');
$this->addSql('DROP TABLE ovh_sms_bundle__sms');
}
}