From 13b8f93e170fa27684a8c63975cf10926f178eee Mon Sep 17 00:00:00 2001 From: wrongecho Date: Thu, 27 Nov 2025 10:27:11 +0000 Subject: [PATCH] Add unique index to ticket, quote and invoice numbers --- db.sql | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/db.sql b/db.sql index 42af2911..928180f0 100644 --- a/db.sql +++ b/db.sql @@ -1324,7 +1324,8 @@ CREATE TABLE `invoices` ( `invoice_category_id` int(11) NOT NULL, `invoice_recurring_invoice_id` int(11) NOT NULL DEFAULT 0, `invoice_client_id` int(11) NOT NULL, - PRIMARY KEY (`invoice_id`) + PRIMARY KEY (`invoice_id`), + UNIQUE KEY `invoice_number` (`invoice_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -1677,7 +1678,8 @@ CREATE TABLE `quotes` ( `quote_archived_at` datetime DEFAULT NULL, `quote_category_id` int(11) NOT NULL, `quote_client_id` int(11) NOT NULL, - PRIMARY KEY (`quote_id`) + PRIMARY KEY (`quote_id`), + UNIQUE KEY `quote_number` (`quote_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -2644,7 +2646,8 @@ CREATE TABLE `tickets` ( `ticket_project_id` int(11) NOT NULL DEFAULT 0, `ticket_recurring_ticket_id` int(11) DEFAULT 0, `ticket_order` int(11) NOT NULL DEFAULT 0, - PRIMARY KEY (`ticket_id`) + PRIMARY KEY (`ticket_id`), + UNIQUE KEY `ticket_number` (`ticket_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */;