USE blitech_facturation_dev;

CREATE TABLE lignes_devis (
  id CHAR(36) NOT NULL,

  id_devis CHAR(36) NOT NULL,

  lib_presta    VARCHAR(255) NOT NULL,
  date_presta   DATE DEFAULT NULL,
  qte           DECIMAL(10,2) NOT NULL,
  prix_unitaire DECIMAL(10,2) NOT NULL,
  type_prix     ENUM('HT','TTC') NOT NULL,

  montant_ht   DECIMAL(10,2) NOT NULL DEFAULT 0,
  montant_ttc  DECIMAL(10,2) NOT NULL DEFAULT 0,
  taux_tva     DECIMAL(4,2)  NOT NULL DEFAULT 20.00,

  PRIMARY KEY (id),

  CONSTRAINT fk_lignes_devis_devis
    FOREIGN KEY (id_devis) REFERENCES devis(id)
    ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB
  DEFAULT CHARSET=utf8mb4
  COLLATE=utf8mb4_unicode_ci;

