migrations/Version20251211132245.php line 1

  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20251211132245 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('CREATE TABLE commande_ticket (id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', tombola_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', user_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', quantite INT NOT NULL, prix DOUBLE PRECISION NOT NULL, date_paiement DATETIME DEFAULT NULL, mode_paiement VARCHAR(255) DEFAULT NULL, status INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_95F4567677CF40C0 (tombola_id), INDEX IDX_95F45676A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE ticket (id INT AUTO_INCREMENT NOT NULL, commande_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', taille VARCHAR(255) NOT NULL, numero INT DEFAULT NULL, INDEX IDX_97A0ADA382EA2E54 (commande_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE tombola (id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', edition_id BINARY(16) NOT NULL COMMENT \'(DC2Type:ulid)\', titre VARCHAR(255) NOT NULL, nombre_tickets INT NOT NULL, dernier_ticket_vendu INT NOT NULL, ticket_restant INT NOT NULL, dateheure_vente_debut DATETIME NOT NULL, dateheure_vente_fin DATETIME NOT NULL, prix DOUBLE PRECISION NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, deleted_at DATETIME DEFAULT NULL, INDEX IDX_3C12E3C574281A5E (edition_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('ALTER TABLE commande_ticket ADD CONSTRAINT FK_95F4567677CF40C0 FOREIGN KEY (tombola_id) REFERENCES tombola (id)');
  22.         $this->addSql('ALTER TABLE commande_ticket ADD CONSTRAINT FK_95F45676A76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id)');
  23.         $this->addSql('ALTER TABLE ticket ADD CONSTRAINT FK_97A0ADA382EA2E54 FOREIGN KEY (commande_id) REFERENCES commande_ticket (id)');
  24.         $this->addSql('ALTER TABLE tombola ADD CONSTRAINT FK_3C12E3C574281A5E FOREIGN KEY (edition_id) REFERENCES edition (id)');
  25.     }
  26.     public function down(Schema $schema): void
  27.     {
  28.         // this down() migration is auto-generated, please modify it to your needs
  29.         $this->addSql('ALTER TABLE commande_ticket DROP FOREIGN KEY FK_95F4567677CF40C0');
  30.         $this->addSql('ALTER TABLE commande_ticket DROP FOREIGN KEY FK_95F45676A76ED395');
  31.         $this->addSql('ALTER TABLE ticket DROP FOREIGN KEY FK_97A0ADA382EA2E54');
  32.         $this->addSql('ALTER TABLE tombola DROP FOREIGN KEY FK_3C12E3C574281A5E');
  33.         $this->addSql('DROP TABLE commande_ticket');
  34.         $this->addSql('DROP TABLE ticket');
  35.         $this->addSql('DROP TABLE tombola');
  36.     }
  37. }