migrations/Version20230927075828.php line 1
<?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 Version20230927075828 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('
CREATE TABLE `provider` (
`id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `app_contact` (
`id` int NOT NULL AUTO_INCREMENT,
`full_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`object` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`message` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`phone` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`is_read` tinyint(1) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`sended_at` datetime NOT NULL COMMENT "(DC2Type:datetime_immutable)",
`is_answered` tinyint(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `country` (
`id` int NOT NULL,
`iso` char(2) DEFAULT NULL,
`name` varchar(80) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `customer` (
`id` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`cif` varchar(25) COLLATE utf8mb4_unicode_ci NOT NULL,
`holder` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`customer_crm` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`provider_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`status` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`country_id` int NOT NULL,
`province_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`address` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`number` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`order` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`sim` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`start_date` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`end_date` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`pvp` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`reference_order` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`subscriber` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`observations` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`call_forwarding` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`end_customer_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`end_customer_cif_nif` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `country_id` (`country_id`),
KEY `provider_id` (`provider_id`),
CONSTRAINT `customer_ibfk_1` FOREIGN KEY (`provider_id`) REFERENCES `provider` (`id`),
CONSTRAINT `customer_ibfk_2` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
CONSTRAINT `customer_ibfk_3` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
CONSTRAINT `customer_ibfk_4` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
CONSTRAINT `customer_ibfk_5` FOREIGN KEY (`country_id`) REFERENCES `country` (`id`),
CONSTRAINT `customer_ibfk_6` FOREIGN KEY (`provider_id`) REFERENCES `provider` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `user` (
`id` int NOT NULL AUTO_INCREMENT,
`username` varchar(180) COLLATE utf8mb4_unicode_ci NOT NULL,
`roles` json NOT NULL,
`nom_complet` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`valid` tinyint(1) NOT NULL,
`deleted` tinyint(1) NOT NULL,
`password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`admin` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UNIQ_8D93D649F85E0677` (`username`),
UNIQUE KEY `UNIQ_8D93D649E7927C74` (`email`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
');
$this->addSql('
CREATE TABLE `history` (
`id` int NOT NULL AUTO_INCREMENT,
`created_at` datetime NOT NULL,
`table_name` varchar(255) NOT NULL,
`entity_id` varchar(255) NOT NULL,
`action` varchar(255) NOT NULL,
`field_name` varchar(255) NOT NULL,
`old_value` longtext,
`new_value` longtext,
`user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=818 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `province` (
`id` smallint DEFAULT NULL,
`name` varchar(30) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `reset_password_request` (
`id` int NOT NULL AUTO_INCREMENT,
`user_id` int DEFAULT NULL,
`selector` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
`hashed_token` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`requested_at` datetime NOT NULL COMMENT "(DC2Type:datetime_immutable)",
`expires_at` datetime NOT NULL COMMENT "(DC2Type:datetime_immutable)",
PRIMARY KEY (`id`),
KEY `IDX_7CE748AA76ED395` (`user_id`),
CONSTRAINT `FK_7CE748AA76ED395` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
$this->addSql('
CREATE TABLE `role` (
`id` int NOT NULL AUTO_INCREMENT,
`role_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
`libelle` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;');
}
public function down(Schema $schema): void
{
$this->addSql('DROP TABLE provider;');
$this->addSql('DROP TABLE user;');
$this->addSql('DROP TABLE customer;');
$this->addSql('DROP TABLE country;');
$this->addSql('DROP TABLE province;');
$this->addSql('DROP TABLE history;');
$this->addSql('DROP TABLE role;');
}
}