diff --git a/migrations/Version20241010155711.php b/migrations/Version20241010155711.php deleted file mode 100644 index cb95793..0000000 --- a/migrations/Version20241010155711.php +++ /dev/null @@ -1,109 +0,0 @@ -addSql('DROP SEQUENCE eat_id_seq CASCADE'); - $this->addSql('CREATE TABLE customer (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, number_phone VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE customer_table (customer_id INT NOT NULL, table_id INT NOT NULL, PRIMARY KEY(customer_id, table_id))'); - $this->addSql('CREATE INDEX IDX_381CFA7D9395C3F3 ON customer_table (customer_id)'); - $this->addSql('CREATE INDEX IDX_381CFA7DECFF285C ON customer_table (table_id)'); - $this->addSql('CREATE TABLE discount (id INT NOT NULL, id_dishes_id INT DEFAULT NULL, description VARCHAR(255) NOT NULL, percentage VARCHAR(255) NOT NULL, fixed_amount DOUBLE PRECISION NOT NULL, start_date DATE NOT NULL, date_end DATE NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_E1E0B40E20686F5D ON discount (id_dishes_id)'); - $this->addSql('CREATE TABLE dishes (id INT NOT NULL, name VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, price DOUBLE PRECISION NOT NULL, category VARCHAR(255) NOT NULL, status VARCHAR(255) NOT NULL, number_order VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE "order" (id INT NOT NULL, id_order_detail_id INT NOT NULL, id_status_order_id INT NOT NULL, date_time DOUBLE PRECISION NOT NULL, status VARCHAR(255) NOT NULL, total VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_F52993988D09BBCB ON "order" (id_order_detail_id)'); - $this->addSql('CREATE INDEX IDX_F5299398F91B0968 ON "order" (id_status_order_id)'); - $this->addSql('CREATE TABLE order_user (order_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(order_id, user_id))'); - $this->addSql('CREATE INDEX IDX_C062EC5E8D9F6D38 ON order_user (order_id)'); - $this->addSql('CREATE INDEX IDX_C062EC5EA76ED395 ON order_user (user_id)'); - $this->addSql('CREATE TABLE order_dishes (order_id INT NOT NULL, dishes_id INT NOT NULL, PRIMARY KEY(order_id, dishes_id))'); - $this->addSql('CREATE INDEX IDX_9BC2C3888D9F6D38 ON order_dishes (order_id)'); - $this->addSql('CREATE INDEX IDX_9BC2C388A05DD37A ON order_dishes (dishes_id)'); - $this->addSql('CREATE TABLE order_detail (id INT NOT NULL, quantity DOUBLE PRECISION NOT NULL, unit_price DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE reservation (id INT NOT NULL, date_time DOUBLE PRECISION NOT NULL, number_people INT NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE reservation_user (reservation_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY(reservation_id, user_id))'); - $this->addSql('CREATE INDEX IDX_9BAA1B21B83297E7 ON reservation_user (reservation_id)'); - $this->addSql('CREATE INDEX IDX_9BAA1B21A76ED395 ON reservation_user (user_id)'); - $this->addSql('CREATE TABLE status_order (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE status_table (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE "table" (id INT NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE "user" (id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)'); - $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)'); - $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)'); - $this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$ - BEGIN - PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text); - RETURN NEW; - END; - $$ LANGUAGE plpgsql;'); - $this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;'); - $this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();'); - $this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7D9395C3F3 FOREIGN KEY (customer_id) REFERENCES customer (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE customer_table ADD CONSTRAINT FK_381CFA7DECFF285C FOREIGN KEY (table_id) REFERENCES "table" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE discount ADD CONSTRAINT FK_E1E0B40E20686F5D FOREIGN KEY (id_dishes_id) REFERENCES dishes (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F52993988D09BBCB FOREIGN KEY (id_order_detail_id) REFERENCES order_detail (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE "order" ADD CONSTRAINT FK_F5299398F91B0968 FOREIGN KEY (id_status_order_id) REFERENCES status_order (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE order_user ADD CONSTRAINT FK_C062EC5E8D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE order_user ADD CONSTRAINT FK_C062EC5EA76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C3888D9F6D38 FOREIGN KEY (order_id) REFERENCES "order" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE order_dishes ADD CONSTRAINT FK_9BC2C388A05DD37A FOREIGN KEY (dishes_id) REFERENCES dishes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE reservation_user ADD CONSTRAINT FK_9BAA1B21B83297E7 FOREIGN KEY (reservation_id) REFERENCES reservation (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE reservation_user ADD CONSTRAINT FK_9BAA1B21A76ED395 FOREIGN KEY (user_id) REFERENCES "user" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE SCHEMA public'); - $this->addSql('CREATE SEQUENCE eat_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7D9395C3F3'); - $this->addSql('ALTER TABLE customer_table DROP CONSTRAINT FK_381CFA7DECFF285C'); - $this->addSql('ALTER TABLE discount DROP CONSTRAINT FK_E1E0B40E20686F5D'); - $this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F52993988D09BBCB'); - $this->addSql('ALTER TABLE "order" DROP CONSTRAINT FK_F5299398F91B0968'); - $this->addSql('ALTER TABLE order_user DROP CONSTRAINT FK_C062EC5E8D9F6D38'); - $this->addSql('ALTER TABLE order_user DROP CONSTRAINT FK_C062EC5EA76ED395'); - $this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C3888D9F6D38'); - $this->addSql('ALTER TABLE order_dishes DROP CONSTRAINT FK_9BC2C388A05DD37A'); - $this->addSql('ALTER TABLE reservation_user DROP CONSTRAINT FK_9BAA1B21B83297E7'); - $this->addSql('ALTER TABLE reservation_user DROP CONSTRAINT FK_9BAA1B21A76ED395'); - $this->addSql('DROP TABLE customer'); - $this->addSql('DROP TABLE customer_table'); - $this->addSql('DROP TABLE discount'); - $this->addSql('DROP TABLE dishes'); - $this->addSql('DROP TABLE "order"'); - $this->addSql('DROP TABLE order_user'); - $this->addSql('DROP TABLE order_dishes'); - $this->addSql('DROP TABLE order_detail'); - $this->addSql('DROP TABLE reservation'); - $this->addSql('DROP TABLE reservation_user'); - $this->addSql('DROP TABLE status_order'); - $this->addSql('DROP TABLE status_table'); - $this->addSql('DROP TABLE "table"'); - $this->addSql('DROP TABLE "user"'); - $this->addSql('DROP TABLE messenger_messages'); - } -} diff --git a/migrations/Version20241020235112.php b/migrations/Version20241020235112.php deleted file mode 100644 index 341fe1f..0000000 --- a/migrations/Version20241020235112.php +++ /dev/null @@ -1,140 +0,0 @@ -addSql('CREATE SEQUENCE clients_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE details_commande_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE plats_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE reductions_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE reservations_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE statut_commandes_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE statut_tables_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE tables_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE utilisateurs_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE TABLE clients (id INT NOT NULL, prenom VARCHAR(255) NOT NULL, nom VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, telephone VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE clients_tables (clients_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(clients_id, tables_id))'); - $this->addSql('CREATE INDEX IDX_8190D6C6AB014612 ON clients_tables (clients_id)'); - $this->addSql('CREATE INDEX IDX_8190D6C685405FD2 ON clients_tables (tables_id)'); - $this->addSql('CREATE TABLE commandes (id INT NOT NULL, statut_commande_id INT DEFAULT NULL, date_heure TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, statut BOOLEAN NOT NULL, total DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_35D4282CFB435DFD ON commandes (statut_commande_id)'); - $this->addSql('CREATE TABLE commandes_clients (commandes_id INT NOT NULL, clients_id INT NOT NULL, PRIMARY KEY(commandes_id, clients_id))'); - $this->addSql('CREATE INDEX IDX_C665A6248BF5C2E6 ON commandes_clients (commandes_id)'); - $this->addSql('CREATE INDEX IDX_C665A624AB014612 ON commandes_clients (clients_id)'); - $this->addSql('CREATE TABLE details_commande (id INT NOT NULL, commande_id INT DEFAULT NULL, quantite INT NOT NULL, prix_unitaire DOUBLE PRECISION NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_4BCD5F682EA2E54 ON details_commande (commande_id)'); - $this->addSql('CREATE TABLE plats (id INT NOT NULL, reduction_id INT DEFAULT NULL, nom VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, categorie VARCHAR(255) NOT NULL, statut BOOLEAN NOT NULL, nb_de_commande INT NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_854A620AC03CB092 ON plats (reduction_id)'); - $this->addSql('CREATE TABLE plats_commandes (plats_id INT NOT NULL, commandes_id INT NOT NULL, PRIMARY KEY(plats_id, commandes_id))'); - $this->addSql('CREATE INDEX IDX_7F8CABAAAA14E1C8 ON plats_commandes (plats_id)'); - $this->addSql('CREATE INDEX IDX_7F8CABAA8BF5C2E6 ON plats_commandes (commandes_id)'); - $this->addSql('CREATE TABLE reductions (id INT NOT NULL, description VARCHAR(255) NOT NULL, prix DOUBLE PRECISION NOT NULL, pourcentage INT NOT NULL, montant_fixe VARCHAR(255) NOT NULL, date_debut TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, date_fin TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE reservations (id INT NOT NULL, tabl_id INT DEFAULT NULL, date_heure TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, nb_de_prsn INT NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_4DA2394DE1870D ON reservations (tabl_id)'); - $this->addSql('CREATE TABLE statut_commandes (id INT NOT NULL, libelle VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE statut_tables (id INT NOT NULL, tabl_id INT DEFAULT NULL, libellé VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_33C8A3754DE1870D ON statut_tables (tabl_id)'); - $this->addSql('CREATE TABLE tables (id INT NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE utilisateurs (id INT NOT NULL, nom VARCHAR(255) NOT NULL, prenom VARCHAR(255) NOT NULL, mail VARCHAR(255) NOT NULL, mot_de_passe VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE utilisateurs_reservations (utilisateurs_id INT NOT NULL, reservations_id INT NOT NULL, PRIMARY KEY(utilisateurs_id, reservations_id))'); - $this->addSql('CREATE INDEX IDX_995A78E71E969C5 ON utilisateurs_reservations (utilisateurs_id)'); - $this->addSql('CREATE INDEX IDX_995A78E7D9A7F869 ON utilisateurs_reservations (reservations_id)'); - $this->addSql('CREATE TABLE utilisateurs_tables (utilisateurs_id INT NOT NULL, tables_id INT NOT NULL, PRIMARY KEY(utilisateurs_id, tables_id))'); - $this->addSql('CREATE INDEX IDX_A9A665291E969C5 ON utilisateurs_tables (utilisateurs_id)'); - $this->addSql('CREATE INDEX IDX_A9A6652985405FD2 ON utilisateurs_tables (tables_id)'); - $this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)'); - $this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)'); - $this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)'); - $this->addSql('COMMENT ON COLUMN messenger_messages.created_at IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('COMMENT ON COLUMN messenger_messages.available_at IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('COMMENT ON COLUMN messenger_messages.delivered_at IS \'(DC2Type:datetime_immutable)\''); - $this->addSql('CREATE OR REPLACE FUNCTION notify_messenger_messages() RETURNS TRIGGER AS $$ - BEGIN - PERFORM pg_notify(\'messenger_messages\', NEW.queue_name::text); - RETURN NEW; - END; - $$ LANGUAGE plpgsql;'); - $this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;'); - $this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();'); - $this->addSql('ALTER TABLE clients_tables ADD CONSTRAINT FK_8190D6C6AB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE clients_tables ADD CONSTRAINT FK_8190D6C685405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE commandes ADD CONSTRAINT FK_35D4282CFB435DFD FOREIGN KEY (statut_commande_id) REFERENCES statut_commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE commandes_clients ADD CONSTRAINT FK_C665A6248BF5C2E6 FOREIGN KEY (commandes_id) REFERENCES commandes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE commandes_clients ADD CONSTRAINT FK_C665A624AB014612 FOREIGN KEY (clients_id) REFERENCES clients (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE details_commande ADD CONSTRAINT FK_4BCD5F682EA2E54 FOREIGN KEY (commande_id) REFERENCES commandes (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE plats ADD CONSTRAINT FK_854A620AC03CB092 FOREIGN KEY (reduction_id) REFERENCES reductions (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE plats_commandes ADD CONSTRAINT FK_7F8CABAAAA14E1C8 FOREIGN KEY (plats_id) REFERENCES plats (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE plats_commandes ADD CONSTRAINT FK_7F8CABAA8BF5C2E6 FOREIGN KEY (commandes_id) REFERENCES commandes (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE reservations ADD CONSTRAINT FK_4DA2394DE1870D FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE statut_tables ADD CONSTRAINT FK_33C8A3754DE1870D FOREIGN KEY (tabl_id) REFERENCES tables (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE utilisateurs_reservations ADD CONSTRAINT FK_995A78E71E969C5 FOREIGN KEY (utilisateurs_id) REFERENCES utilisateurs (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE utilisateurs_reservations ADD CONSTRAINT FK_995A78E7D9A7F869 FOREIGN KEY (reservations_id) REFERENCES reservations (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE utilisateurs_tables ADD CONSTRAINT FK_A9A665291E969C5 FOREIGN KEY (utilisateurs_id) REFERENCES utilisateurs (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE utilisateurs_tables ADD CONSTRAINT FK_A9A6652985405FD2 FOREIGN KEY (tables_id) REFERENCES tables (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('DROP SEQUENCE clients_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE commandes_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE details_commande_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE plats_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE reductions_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE reservations_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE statut_commandes_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE statut_tables_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE tables_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE utilisateurs_id_seq CASCADE'); - $this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT FK_8190D6C6AB014612'); - $this->addSql('ALTER TABLE clients_tables DROP CONSTRAINT FK_8190D6C685405FD2'); - $this->addSql('ALTER TABLE commandes DROP CONSTRAINT FK_35D4282CFB435DFD'); - $this->addSql('ALTER TABLE commandes_clients DROP CONSTRAINT FK_C665A6248BF5C2E6'); - $this->addSql('ALTER TABLE commandes_clients DROP CONSTRAINT FK_C665A624AB014612'); - $this->addSql('ALTER TABLE details_commande DROP CONSTRAINT FK_4BCD5F682EA2E54'); - $this->addSql('ALTER TABLE plats DROP CONSTRAINT FK_854A620AC03CB092'); - $this->addSql('ALTER TABLE plats_commandes DROP CONSTRAINT FK_7F8CABAAAA14E1C8'); - $this->addSql('ALTER TABLE plats_commandes DROP CONSTRAINT FK_7F8CABAA8BF5C2E6'); - $this->addSql('ALTER TABLE reservations DROP CONSTRAINT FK_4DA2394DE1870D'); - $this->addSql('ALTER TABLE statut_tables DROP CONSTRAINT FK_33C8A3754DE1870D'); - $this->addSql('ALTER TABLE utilisateurs_reservations DROP CONSTRAINT FK_995A78E71E969C5'); - $this->addSql('ALTER TABLE utilisateurs_reservations DROP CONSTRAINT FK_995A78E7D9A7F869'); - $this->addSql('ALTER TABLE utilisateurs_tables DROP CONSTRAINT FK_A9A665291E969C5'); - $this->addSql('ALTER TABLE utilisateurs_tables DROP CONSTRAINT FK_A9A6652985405FD2'); - $this->addSql('DROP TABLE clients'); - $this->addSql('DROP TABLE clients_tables'); - $this->addSql('DROP TABLE commandes'); - $this->addSql('DROP TABLE commandes_clients'); - $this->addSql('DROP TABLE details_commande'); - $this->addSql('DROP TABLE plats'); - $this->addSql('DROP TABLE plats_commandes'); - $this->addSql('DROP TABLE reductions'); - $this->addSql('DROP TABLE reservations'); - $this->addSql('DROP TABLE statut_commandes'); - $this->addSql('DROP TABLE statut_tables'); - $this->addSql('DROP TABLE tables'); - $this->addSql('DROP TABLE utilisateurs'); - $this->addSql('DROP TABLE utilisateurs_reservations'); - $this->addSql('DROP TABLE utilisateurs_tables'); - $this->addSql('DROP TABLE messenger_messages'); - } -} diff --git a/migrations/Version20241024193330.php b/migrations/Version20241024193330.php deleted file mode 100644 index b929218..0000000 --- a/migrations/Version20241024193330.php +++ /dev/null @@ -1,34 +0,0 @@ -addSql('ALTER TABLE utilisateurs ALTER role TYPE JSON USING role::json'); - $this->addSql('COMMENT ON COLUMN utilisateurs.role IS NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE SCHEMA public'); - $this->addSql('ALTER TABLE utilisateurs ALTER role TYPE TEXT'); - $this->addSql('COMMENT ON COLUMN utilisateurs.role IS \'(DC2Type:array)\''); - } -} diff --git a/public/css/ControllerVues/new.css b/public/css/ControllerVues/new.css index 07c98d1..c442783 100644 --- a/public/css/ControllerVues/new.css +++ b/public/css/ControllerVues/new.css @@ -123,3 +123,4 @@ body::after { height: 20px; display: block; } + diff --git a/src/Controller/ClientsController.php b/src/Controller/ClientsController.php index 83dea14..2c41873 100644 --- a/src/Controller/ClientsController.php +++ b/src/Controller/ClientsController.php @@ -1,7 +1,6 @@ render('commandes/show.html.twig', [ - 'commande' => $commande, - ]); - } - #[Route('/{id}/edit', name: 'app_commandes_edit', methods: ['GET', 'POST'])] public function edit(Request $request, Commandes $commande, EntityManagerInterface $entityManager): Response { @@ -69,8 +61,9 @@ final class CommandesController extends AbstractController } #[Route('/{id}', name: 'app_commandes_delete', methods: ['POST'])] - public function delete(Request $request, Commandes $commande, EntityManagerInterface $entityManager): Response + public function delete(Request $request, Commandes $commande, EntityManagerInterface $entityManager, int $id): Response { + if ($this->isCsrfTokenValid('delete'.$commande->getId(), $request->getPayload()->getString('_token'))) { $entityManager->remove($commande); $entityManager->flush(); diff --git a/src/Entity/StatutTables.php b/src/Entity/StatutTables.php index 5b500b9..1093ed5 100644 --- a/src/Entity/StatutTables.php +++ b/src/Entity/StatutTables.php @@ -14,7 +14,7 @@ class StatutTables private ?int $id = null; #[ORM\Column(length: 255)] - private ?string $Libellé = null; + private ?string $Libelle = null; #[ORM\ManyToOne(inversedBy: 'statutTables')] private ?Tables $tables = null; @@ -24,14 +24,14 @@ class StatutTables return $this->id; } - public function getLibellé(): ?string + public function getLibelle(): ?string { - return $this->Libellé; + return $this->Libelle; } - public function setLibellé(string $Libellé): static + public function setLibelle(string $Libelle): static { - $this->Libellé = $Libellé; + $this->Libelle = $Libelle; return $this; } diff --git a/src/Form/StatutTablesType.php b/src/Form/StatutTablesType.php index ff6c013..70797d0 100644 --- a/src/Form/StatutTablesType.php +++ b/src/Form/StatutTablesType.php @@ -14,10 +14,11 @@ class StatutTablesType extends AbstractType public function buildForm(FormBuilderInterface $builder, array $options): void { $builder - ->add('Libellé') + ->add('Libelle') ->add('tables', EntityType::class, [ 'class' => Tables::class, 'choice_label' => 'id', + 'mapped' => false, ]) ; } diff --git a/templates/clients/_delete_form.html.twig b/templates/clients/_delete_form.html.twig index f4deca2..60f8140 100644 --- a/templates/clients/_delete_form.html.twig +++ b/templates/clients/_delete_form.html.twig @@ -1,4 +1,4 @@ -
diff --git a/templates/clients/_form.html.twig b/templates/clients/_form.html.twig index bf20b98..7fe26a6 100644 --- a/templates/clients/_form.html.twig +++ b/templates/clients/_form.html.twig @@ -1,4 +1,4 @@ {{ form_start(form) }} {{ form_widget(form) }} - + {{ form_end(form) }} diff --git a/templates/clients/edit.html.twig b/templates/clients/edit.html.twig index 8047809..bea3e03 100644 --- a/templates/clients/edit.html.twig +++ b/templates/clients/edit.html.twig @@ -7,7 +7,7 @@ {{ include('clients/_form.html.twig', {'button_label': 'Mettre à jour'}) }} - retour à la liste + Retour à la liste {{ include('clients/_delete_form.html.twig') }} {% endblock %} diff --git a/templates/clients/index.html.twig b/templates/clients/index.html.twig index 2b41290..9eeb216 100644 --- a/templates/clients/index.html.twig +++ b/templates/clients/index.html.twig @@ -28,11 +28,11 @@Id | -{{ statut_commande.id }} | -
---|---|
Libelle | -{{ statut_commande.Libelle }} | -