migrations/Version20260927194501.php line 1

Open in your IDE?
  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 Version20260927194501 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_caisse (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, entreprise_id INT DEFAULT NULL, table_id INT DEFAULT NULL, client_id INT DEFAULT NULL, cree_par_user_id INT DEFAULT NULL, cree_par_salarie_id INT DEFAULT NULL, devis_id INT DEFAULT NULL, statut VARCHAR(20) NOT NULL, type_commande VARCHAR(20) DEFAULT \'vente\' NOT NULL, nb_couverts INT DEFAULT NULL, libelle VARCHAR(120) DEFAULT NULL, note LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, closed_at DATETIME DEFAULT NULL, INDEX IDX_B0F7A81DA76ED395 (user_id), INDEX IDX_B0F7A81DA4AEAFEA (entreprise_id), INDEX IDX_B0F7A81DECFF285C (table_id), INDEX IDX_B0F7A81D19EB6921 (client_id), INDEX IDX_B0F7A81DAFF36F06 (cree_par_user_id), INDEX IDX_B0F7A81D61C29BA6 (cree_par_salarie_id), UNIQUE INDEX UNIQ_B0F7A81D41DEFADA (devis_id), INDEX idx_commande_caisse_statut (user_id, statut), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('CREATE TABLE ligne_commande_caisse (id INT AUTO_INCREMENT NOT NULL, commande_id INT NOT NULL, produit_id INT DEFAULT NULL, libelle VARCHAR(255) NOT NULL, quantite DOUBLE PRECISION NOT NULL, prix_unitaire_ht DOUBLE PRECISION NOT NULL, taux_tva DOUBLE PRECISION NOT NULL, remise_manuelle DOUBLE PRECISION DEFAULT NULL, remise_produit DOUBLE PRECISION DEFAULT \'0\' NOT NULL, note VARCHAR(255) DEFAULT NULL, quantite_envoyee_cuisine DOUBLE PRECISION DEFAULT \'0\' NOT NULL, created_at DATETIME NOT NULL, INDEX IDX_BB16C90E82EA2E54 (commande_id), INDEX IDX_BB16C90EF347EFB (produit_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         $this->addSql('CREATE TABLE salle_restaurant (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, nom VARCHAR(80) NOT NULL, position INT DEFAULT 0 NOT NULL, INDEX IDX_8019E7A7A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  21.         $this->addSql('CREATE TABLE sequence_numero (id INT AUTO_INCREMENT NOT NULL, portee VARCHAR(191) NOT NULL, dernier INT NOT NULL, UNIQUE INDEX uniq_sequence_portee (portee), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  22.         $this->addSql('CREATE TABLE table_restaurant (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, salle_id INT NOT NULL, nom VARCHAR(40) NOT NULL, capacite INT DEFAULT 4 NOT NULL, position INT DEFAULT 0 NOT NULL, active TINYINT(1) DEFAULT 1 NOT NULL, INDEX IDX_B67B4A52A76ED395 (user_id), INDEX IDX_B67B4A52DC304035 (salle_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  23.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81DA76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
  24.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81DA4AEAFEA FOREIGN KEY (entreprise_id) REFERENCES entreprise (id) ON DELETE SET NULL');
  25.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81DECFF285C FOREIGN KEY (table_id) REFERENCES table_restaurant (id) ON DELETE SET NULL');
  26.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81D19EB6921 FOREIGN KEY (client_id) REFERENCES client (id) ON DELETE SET NULL');
  27.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81DAFF36F06 FOREIGN KEY (cree_par_user_id) REFERENCES user (id) ON DELETE SET NULL');
  28.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81D61C29BA6 FOREIGN KEY (cree_par_salarie_id) REFERENCES salarie (id) ON DELETE SET NULL');
  29.         $this->addSql('ALTER TABLE commande_caisse ADD CONSTRAINT FK_B0F7A81D41DEFADA FOREIGN KEY (devis_id) REFERENCES devis (id) ON DELETE SET NULL');
  30.         $this->addSql('ALTER TABLE ligne_commande_caisse ADD CONSTRAINT FK_BB16C90E82EA2E54 FOREIGN KEY (commande_id) REFERENCES commande_caisse (id) ON DELETE CASCADE');
  31.         $this->addSql('ALTER TABLE ligne_commande_caisse ADD CONSTRAINT FK_BB16C90EF347EFB FOREIGN KEY (produit_id) REFERENCES produit (id) ON DELETE SET NULL');
  32.         $this->addSql('ALTER TABLE salle_restaurant ADD CONSTRAINT FK_8019E7A7A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
  33.         $this->addSql('ALTER TABLE table_restaurant ADD CONSTRAINT FK_B67B4A52A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE');
  34.         $this->addSql('ALTER TABLE table_restaurant ADD CONSTRAINT FK_B67B4A52DC304035 FOREIGN KEY (salle_id) REFERENCES salle_restaurant (id) ON DELETE CASCADE');
  35.         $this->addSql('ALTER TABLE centre_formation CHANGE specialties specialties JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  36.         $this->addSql('ALTER TABLE details_facture CHANGE tva_rate tva_rate NUMERIC(10, 2) DEFAULT \'19\', CHANGE discount_rate discount_rate NUMERIC(10, 2) DEFAULT \'0\'');
  37.         $this->addSql('ALTER TABLE entreprise ADD caisse_commandes_en_attente TINYINT(1) DEFAULT 1 NOT NULL, ADD caisse_mode_restaurant TINYINT(1) DEFAULT 0 NOT NULL, ADD caisse_gestion_tables TINYINT(1) DEFAULT 0 NOT NULL, ADD caisse_ticket_cuisine TINYINT(1) DEFAULT 0 NOT NULL, ADD caisse_demander_couverts TINYINT(1) DEFAULT 0 NOT NULL');
  38.         $this->addSql('ALTER TABLE ligne_facture_fournisseur CHANGE remise_pourcentage remise_pourcentage NUMERIC(5, 2) DEFAULT \'0\' NOT NULL');
  39.         $this->addSql('ALTER TABLE produit CHANGE prix_vente prix_vente NUMERIC(10, 3) DEFAULT \'0\' NOT NULL');
  40.         $this->addSql('ALTER TABLE salarie ADD acces_encaissement TINYINT(1) DEFAULT 1 NOT NULL');
  41.         $this->addSql('ALTER TABLE user_page CHANGE sections sections JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  42.     }
  43.     public function down(Schema $schema): void
  44.     {
  45.         // this down() migration is auto-generated, please modify it to your needs
  46.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81DA76ED395');
  47.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81DA4AEAFEA');
  48.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81DECFF285C');
  49.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81D19EB6921');
  50.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81DAFF36F06');
  51.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81D61C29BA6');
  52.         $this->addSql('ALTER TABLE commande_caisse DROP FOREIGN KEY FK_B0F7A81D41DEFADA');
  53.         $this->addSql('ALTER TABLE ligne_commande_caisse DROP FOREIGN KEY FK_BB16C90E82EA2E54');
  54.         $this->addSql('ALTER TABLE ligne_commande_caisse DROP FOREIGN KEY FK_BB16C90EF347EFB');
  55.         $this->addSql('ALTER TABLE salle_restaurant DROP FOREIGN KEY FK_8019E7A7A76ED395');
  56.         $this->addSql('ALTER TABLE table_restaurant DROP FOREIGN KEY FK_B67B4A52A76ED395');
  57.         $this->addSql('ALTER TABLE table_restaurant DROP FOREIGN KEY FK_B67B4A52DC304035');
  58.         $this->addSql('DROP TABLE commande_caisse');
  59.         $this->addSql('DROP TABLE ligne_commande_caisse');
  60.         $this->addSql('DROP TABLE salle_restaurant');
  61.         $this->addSql('DROP TABLE sequence_numero');
  62.         $this->addSql('DROP TABLE table_restaurant');
  63.         $this->addSql('ALTER TABLE ligne_facture_fournisseur CHANGE remise_pourcentage remise_pourcentage NUMERIC(5, 2) DEFAULT \'0.00\' NOT NULL');
  64.         $this->addSql('ALTER TABLE produit CHANGE prix_vente prix_vente NUMERIC(10, 3) DEFAULT \'0.000\' NOT NULL');
  65.         $this->addSql('ALTER TABLE user_page CHANGE sections sections JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  66.         $this->addSql('ALTER TABLE details_facture CHANGE tva_rate tva_rate NUMERIC(10, 2) DEFAULT \'19.00\', CHANGE discount_rate discount_rate NUMERIC(10, 2) DEFAULT \'0.00\'');
  67.         $this->addSql('ALTER TABLE salarie DROP acces_encaissement');
  68.         $this->addSql('ALTER TABLE entreprise DROP caisse_commandes_en_attente, DROP caisse_mode_restaurant, DROP caisse_gestion_tables, DROP caisse_ticket_cuisine, DROP caisse_demander_couverts');
  69.         $this->addSql('ALTER TABLE centre_formation CHANGE specialties specialties JSON DEFAULT NULL COMMENT \'(DC2Type:json)\'');
  70.     }
  71. }