<?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 Version20230502093241 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 armoire (id_armoire INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, nb_position INT NOT NULL, PRIMARY KEY(id_armoire)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE categorie (id_categorie INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, PRIMARY KEY(id_categorie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE classeur (id_classeur INT AUTO_INCREMENT NOT NULL, armoire_id INT NOT NULL, etagere_id INT NOT NULL, nom VARCHAR(255) NOT NULL, couleur VARCHAR(255) NOT NULL, INDEX IDX_D15F835ACFB9323 (armoire_id), INDEX IDX_D15F835A6588D180 (etagere_id), PRIMARY KEY(id_classeur)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE etagere (id_etagere INT AUTO_INCREMENT NOT NULL, armoire_id INT NOT NULL, nom VARCHAR(255) NOT NULL, INDEX IDX_B83FE5C4CFB9323 (armoire_id), PRIMARY KEY(id_etagere)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE forme (id_forme INT AUTO_INCREMENT NOT NULL, type_collection_id INT NOT NULL, nom VARCHAR(255) NOT NULL, INDEX IDX_9EBAEA621A4E1C8 (type_collection_id), PRIMARY KEY(id_forme)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE localisation (id_localisation INT AUTO_INCREMENT NOT NULL, ville VARCHAR(255) DEFAULT NULL, departement VARCHAR(255) DEFAULT NULL, region VARCHAR(255) DEFAULT NULL, pays VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id_localisation)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE matiere (id_matiere INT AUTO_INCREMENT NOT NULL, type_collection_id INT NOT NULL, nom VARCHAR(255) NOT NULL, INDEX IDX_9014574A21A4E1C8 (type_collection_id), PRIMARY KEY(id_matiere)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE model (id_model INT AUTO_INCREMENT NOT NULL, matiere_id INT NOT NULL, forme_id INT NOT NULL, localisation_id INT NOT NULL, type_collection_id INT NOT NULL, annee INT DEFAULT NULL, nb_exemplaire_edite VARCHAR(255) DEFAULT NULL, fournisseur VARCHAR(255) DEFAULT NULL, titre VARCHAR(255) NOT NULL, description VARCHAR(2000) NOT NULL, nb INT NOT NULL, date_creation DATETIME NOT NULL, date_modification DATETIME NOT NULL, diametre VARCHAR(255) DEFAULT NULL, reference VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_D79572D9F46CD258 (matiere_id), INDEX IDX_D79572D9BCE84E7C (forme_id), INDEX IDX_D79572D9C68BE09C (localisation_id), INDEX IDX_D79572D921A4E1C8 (type_collection_id), PRIMARY KEY(id_model)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE model_categorie (id_model INT NOT NULL, id_categorie INT NOT NULL, INDEX IDX_70B4BFA7391033E9 (id_model), INDEX IDX_70B4BFA7C9486A13 (id_categorie), PRIMARY KEY(id_model, id_categorie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE model_ss_categorie (id_model INT NOT NULL, id_sous_categorie INT NOT NULL, INDEX IDX_17812AC391033E9 (id_model), INDEX IDX_17812AC6F12807D (id_sous_categorie), PRIMARY KEY(id_model, id_sous_categorie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE model_tag (id_model INT NOT NULL, id_tag INT NOT NULL, INDEX IDX_564ADD7C391033E9 (id_model), INDEX IDX_564ADD7C9D2D5FD9 (id_tag), PRIMARY KEY(id_model, id_tag)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE model_page (id_model INT NOT NULL, id_page INT NOT NULL, INDEX IDX_395D9AC7391033E9 (id_model), INDEX IDX_395D9AC79F2AAA22 (id_page), PRIMARY KEY(id_model, id_page)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE page (id_page INT AUTO_INCREMENT NOT NULL, classeur_id INT NOT NULL, numero INT NOT NULL, INDEX IDX_140AB620EC10E96A (classeur_id), PRIMARY KEY(id_page)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE photo (id_photo INT AUTO_INCREMENT NOT NULL, model_id INT DEFAULT NULL, chemin VARCHAR(255) NOT NULL, INDEX IDX_14B784187975B7E7 (model_id), PRIMARY KEY(id_photo)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE reset_password_request (id INT AUTO_INCREMENT NOT NULL, user_id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', selector VARCHAR(20) NOT NULL, hashed_token VARCHAR(100) NOT NULL, requested_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', expires_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_7CE748AA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE sous_categorie (id_sous_categorie INT AUTO_INCREMENT NOT NULL, categorie_id INT NOT NULL, nom VARCHAR(255) NOT NULL, INDEX IDX_52743D7BBCF5E72D (categorie_id), PRIMARY KEY(id_sous_categorie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE tag (id_tag INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, PRIMARY KEY(id_tag)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE type_collection (id_type_collection INT AUTO_INCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, PRIMARY KEY(id_type_collection)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE typeCollection_categorie (id_type_collection INT NOT NULL, id_categorie INT NOT NULL, INDEX IDX_8F61AC02810709F (id_type_collection), INDEX IDX_8F61AC02C9486A13 (id_categorie), PRIMARY KEY(id_type_collection, id_categorie)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user (id BINARY(16) NOT NULL COMMENT \'(DC2Type:uuid)\', email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, name VARCHAR(255) DEFAULT NULL, surname VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL, INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE classeur ADD CONSTRAINT FK_D15F835ACFB9323 FOREIGN KEY (armoire_id) REFERENCES armoire (id_armoire)');
$this->addSql('ALTER TABLE classeur ADD CONSTRAINT FK_D15F835A6588D180 FOREIGN KEY (etagere_id) REFERENCES etagere (id_etagere)');
$this->addSql('ALTER TABLE etagere ADD CONSTRAINT FK_B83FE5C4CFB9323 FOREIGN KEY (armoire_id) REFERENCES armoire (id_armoire)');
$this->addSql('ALTER TABLE forme ADD CONSTRAINT FK_9EBAEA621A4E1C8 FOREIGN KEY (type_collection_id) REFERENCES type_collection (id_type_collection)');
$this->addSql('ALTER TABLE matiere ADD CONSTRAINT FK_9014574A21A4E1C8 FOREIGN KEY (type_collection_id) REFERENCES type_collection (id_type_collection)');
$this->addSql('ALTER TABLE model ADD CONSTRAINT FK_D79572D9F46CD258 FOREIGN KEY (matiere_id) REFERENCES matiere (id_matiere)');
$this->addSql('ALTER TABLE model ADD CONSTRAINT FK_D79572D9BCE84E7C FOREIGN KEY (forme_id) REFERENCES forme (id_forme)');
$this->addSql('ALTER TABLE model ADD CONSTRAINT FK_D79572D9C68BE09C FOREIGN KEY (localisation_id) REFERENCES localisation (id_localisation)');
$this->addSql('ALTER TABLE model ADD CONSTRAINT FK_D79572D921A4E1C8 FOREIGN KEY (type_collection_id) REFERENCES type_collection (id_type_collection)');
$this->addSql('ALTER TABLE model_categorie ADD CONSTRAINT FK_70B4BFA7391033E9 FOREIGN KEY (id_model) REFERENCES model (id_model)');
$this->addSql('ALTER TABLE model_categorie ADD CONSTRAINT FK_70B4BFA7C9486A13 FOREIGN KEY (id_categorie) REFERENCES categorie (id_categorie)');
$this->addSql('ALTER TABLE model_ss_categorie ADD CONSTRAINT FK_17812AC391033E9 FOREIGN KEY (id_model) REFERENCES model (id_model)');
$this->addSql('ALTER TABLE model_ss_categorie ADD CONSTRAINT FK_17812AC6F12807D FOREIGN KEY (id_sous_categorie) REFERENCES sous_categorie (id_sous_categorie)');
$this->addSql('ALTER TABLE model_tag ADD CONSTRAINT FK_564ADD7C391033E9 FOREIGN KEY (id_model) REFERENCES model (id_model)');
$this->addSql('ALTER TABLE model_tag ADD CONSTRAINT FK_564ADD7C9D2D5FD9 FOREIGN KEY (id_tag) REFERENCES tag (id_tag)');
$this->addSql('ALTER TABLE model_page ADD CONSTRAINT FK_395D9AC7391033E9 FOREIGN KEY (id_model) REFERENCES model (id_model)');
$this->addSql('ALTER TABLE model_page ADD CONSTRAINT FK_395D9AC79F2AAA22 FOREIGN KEY (id_page) REFERENCES page (id_page)');
$this->addSql('ALTER TABLE page ADD CONSTRAINT FK_140AB620EC10E96A FOREIGN KEY (classeur_id) REFERENCES classeur (id_classeur)');
$this->addSql('ALTER TABLE photo ADD CONSTRAINT FK_14B784187975B7E7 FOREIGN KEY (model_id) REFERENCES model (id_model)');
$this->addSql('ALTER TABLE reset_password_request ADD CONSTRAINT FK_7CE748AA76ED395 FOREIGN KEY (user_id) REFERENCES user (id)');
$this->addSql('ALTER TABLE sous_categorie ADD CONSTRAINT FK_52743D7BBCF5E72D FOREIGN KEY (categorie_id) REFERENCES categorie (id_categorie)');
$this->addSql('ALTER TABLE typeCollection_categorie ADD CONSTRAINT FK_8F61AC02810709F FOREIGN KEY (id_type_collection) REFERENCES type_collection (id_type_collection)');
$this->addSql('ALTER TABLE typeCollection_categorie ADD CONSTRAINT FK_8F61AC02C9486A13 FOREIGN KEY (id_categorie) REFERENCES categorie (id_categorie)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE classeur DROP FOREIGN KEY FK_D15F835ACFB9323');
$this->addSql('ALTER TABLE classeur DROP FOREIGN KEY FK_D15F835A6588D180');
$this->addSql('ALTER TABLE etagere DROP FOREIGN KEY FK_B83FE5C4CFB9323');
$this->addSql('ALTER TABLE forme DROP FOREIGN KEY FK_9EBAEA621A4E1C8');
$this->addSql('ALTER TABLE matiere DROP FOREIGN KEY FK_9014574A21A4E1C8');
$this->addSql('ALTER TABLE model DROP FOREIGN KEY FK_D79572D9F46CD258');
$this->addSql('ALTER TABLE model DROP FOREIGN KEY FK_D79572D9BCE84E7C');
$this->addSql('ALTER TABLE model DROP FOREIGN KEY FK_D79572D9C68BE09C');
$this->addSql('ALTER TABLE model DROP FOREIGN KEY FK_D79572D921A4E1C8');
$this->addSql('ALTER TABLE model_categorie DROP FOREIGN KEY FK_70B4BFA7391033E9');
$this->addSql('ALTER TABLE model_categorie DROP FOREIGN KEY FK_70B4BFA7C9486A13');
$this->addSql('ALTER TABLE model_ss_categorie DROP FOREIGN KEY FK_17812AC391033E9');
$this->addSql('ALTER TABLE model_ss_categorie DROP FOREIGN KEY FK_17812AC6F12807D');
$this->addSql('ALTER TABLE model_tag DROP FOREIGN KEY FK_564ADD7C391033E9');
$this->addSql('ALTER TABLE model_tag DROP FOREIGN KEY FK_564ADD7C9D2D5FD9');
$this->addSql('ALTER TABLE model_page DROP FOREIGN KEY FK_395D9AC7391033E9');
$this->addSql('ALTER TABLE model_page DROP FOREIGN KEY FK_395D9AC79F2AAA22');
$this->addSql('ALTER TABLE page DROP FOREIGN KEY FK_140AB620EC10E96A');
$this->addSql('ALTER TABLE photo DROP FOREIGN KEY FK_14B784187975B7E7');
$this->addSql('ALTER TABLE reset_password_request DROP FOREIGN KEY FK_7CE748AA76ED395');
$this->addSql('ALTER TABLE sous_categorie DROP FOREIGN KEY FK_52743D7BBCF5E72D');
$this->addSql('ALTER TABLE typeCollection_categorie DROP FOREIGN KEY FK_8F61AC02810709F');
$this->addSql('ALTER TABLE typeCollection_categorie DROP FOREIGN KEY FK_8F61AC02C9486A13');
$this->addSql('DROP TABLE armoire');
$this->addSql('DROP TABLE categorie');
$this->addSql('DROP TABLE classeur');
$this->addSql('DROP TABLE etagere');
$this->addSql('DROP TABLE forme');
$this->addSql('DROP TABLE localisation');
$this->addSql('DROP TABLE matiere');
$this->addSql('DROP TABLE model');
$this->addSql('DROP TABLE model_categorie');
$this->addSql('DROP TABLE model_ss_categorie');
$this->addSql('DROP TABLE model_tag');
$this->addSql('DROP TABLE model_page');
$this->addSql('DROP TABLE page');
$this->addSql('DROP TABLE photo');
$this->addSql('DROP TABLE reset_password_request');
$this->addSql('DROP TABLE sous_categorie');
$this->addSql('DROP TABLE tag');
$this->addSql('DROP TABLE type_collection');
$this->addSql('DROP TABLE typeCollection_categorie');
$this->addSql('DROP TABLE user');
$this->addSql('DROP TABLE messenger_messages');
}
}