From 0b889ec443329d6e2018efc449d2d19b253f87d7 Mon Sep 17 00:00:00 2001 From: Steve Ireland Date: Sat, 22 Jun 2024 21:30:04 -0400 Subject: [PATCH] Clean up install.md a bit (#4012) Corrected primary keys involving person_id. Corrected a couple of errors in constraints involving compound keys. --- BUILD.md | 4 +--- app/Database/constraints.sql | 4 ++-- app/Database/tables.sql | 12 ++++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/BUILD.md b/BUILD.md index e2b9c3b48..9afe11fb2 100644 --- a/BUILD.md +++ b/BUILD.md @@ -12,8 +12,6 @@ The goal here is to set up and configure the build process so that the actual bu The build process uses the build tools "npm" and "gulp" to piece everything together. -This applies only to the upcoming 3.4.0 release of OSPOS which is being worked on in the CI4 branch, where we are upgrading OSPOS to version 4 of the CodeIgniter framework. - ## Prerequisites - Install the latest version of NPM (tested using version 9.4.2) @@ -21,7 +19,7 @@ This applies only to the upcoming 3.4.0 release of OSPOS which is being worked o ## The Workflow -1. Download the code from the CI4 branch found at https://github.com/opensourcepos/opensourcepos/tree/ci4-upgrade. +1. Download the code from the master branch found at https://github.com/opensourcepos/opensourcepos/tree/master. 2. Unzip it and copy the contents into the working folder. 3. Start a terminal session from the root of your working folder. For example, I normally open up the working folder in PHPStorm and run the commands from the Terminal provided by the IDE. 4. Enter the following three commands in sequence: diff --git a/app/Database/constraints.sql b/app/Database/constraints.sql index b97aaaefc..5e8f596e9 100644 --- a/app/Database/constraints.sql +++ b/app/Database/constraints.sql @@ -88,7 +88,7 @@ ALTER TABLE `ospos_sales_items` -- Constraints for table `ospos_sales_items_taxes` -- ALTER TABLE `ospos_sales_items_taxes` - ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_items` (`sale_id`), + ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`,`item_id`,`line`) REFERENCES `ospos_sales_items` (`sale_id`,`item_id`,`line`), ADD CONSTRAINT `ospos_sales_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); -- @@ -116,7 +116,7 @@ ALTER TABLE `ospos_sales_suspended_items` -- Constraints for table `ospos_sales_suspended_items_taxes` -- ALTER TABLE `ospos_sales_suspended_items_taxes` - ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`) REFERENCES `ospos_sales_suspended_items` (`sale_id`), + ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_1` FOREIGN KEY (`sale_id`,`item_id`,`line`) REFERENCES `ospos_sales_suspended_items` (`sale_id`,`item_id`,`line`), ADD CONSTRAINT `ospos_sales_suspended_items_taxes_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `ospos_items` (`item_id`); -- diff --git a/app/Database/tables.sql b/app/Database/tables.sql index 3d13af4c5..4a9b3934e 100644 --- a/app/Database/tables.sql +++ b/app/Database/tables.sql @@ -98,8 +98,8 @@ CREATE TABLE `ospos_customers` ( `taxable` int(1) NOT NULL DEFAULT '1', `discount_percent` decimal(15,2) NOT NULL DEFAULT '0', `deleted` int(1) NOT NULL DEFAULT '0', - UNIQUE KEY `account_number` (`account_number`), - KEY `person_id` (`person_id`) + PRIMARY KEY `person_id` (`person_id`), + UNIQUE KEY `account_number` (`account_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -119,8 +119,8 @@ CREATE TABLE `ospos_employees` ( `person_id` int(10) NOT NULL, `deleted` int(1) NOT NULL DEFAULT '0', `hash_version` int(1) NOT NULL DEFAULT '2', - UNIQUE KEY `username` (`username`), - KEY `person_id` (`person_id`) + PRIMARY KEY `person_id` (`person_id`) + UNIQUE KEY `username` (`username`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- @@ -723,8 +723,8 @@ CREATE TABLE `ospos_suppliers` ( `agency_name` varchar(255) NOT NULL, `account_number` varchar(255) DEFAULT NULL, `deleted` int(1) NOT NULL DEFAULT '0', - UNIQUE KEY `account_number` (`account_number`), - KEY `person_id` (`person_id`) + PRIMARY KEY `person_id` (`person_id`), + UNIQUE KEY `account_number` (`account_number`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --