Feat: Contact Form MySQL database created and hooked up to web app on form submission. \n Fix: Removal of ERP and otherwise deprecated database and server code..

This commit is contained in:
2025-03-21 11:12:03 +00:00
parent 63776954e1
commit 4f5037b504
477 changed files with 4298 additions and 102117 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,337 +1,71 @@
/* Clear Store DataBase */
USE partsltd_prod;
-- Permanent Temp Tables
DROP TABLE IF EXISTS partsltd_prod.tmp_ph_Calc_User;
DROP TABLE IF EXISTS partsltd_prod.tmp_core_Msg_Error;
DROP TABLE IF EXISTS partsltd_prod.tmp_ph_User;
DROP TABLE IF EXISTS partsltd_prod.tmp_ph_User_Role_Link;
-- Drop dependencies
DROP TABLE IF EXISTS tmp_Shop_Calc_User;
DROP TABLE IF EXISTS tmp_Product_Calc_User;
DROP TABLE IF EXISTS tmp_Product_p_Shop_User_Eval;
DROP TABLE IF EXISTS tmp_Msg_Error;
DROP TABLE IF EXISTS tmp_Currency;
DROP TABLE IF EXISTS tmp_Delivery_Option;
DROP TABLE IF EXISTS tmp_Delivery_Region;
DROP TABLE IF EXISTS tmp_Region;
DROP TABLE IF EXISTS tmp_Price;
DROP TABLE IF EXISTS tmp_Shop_User;
DROP TABLE IF EXISTS tmp_Shop_Order;
DROP TABLE IF EXISTS tmp_Shop_Product;
DROP TABLE IF EXISTS tmp_Product;
DROP TABLE IF EXISTS tmp_Product_Permutation;
DROP TABLE IF EXISTS tmp_Permutation_Variation_Link;
DROP TABLE IF EXISTS tmp_Permutation;
DROP TABLE IF EXISTS tmp_Shop_Product_p_shop_calc_user;
DROP TABLE IF EXISTS tmp_Shop_Product_p_Shop_Calc_User;
DROP TABLE IF EXISTS tmp_Shop_Image;
DROP TABLE IF EXISTS tmp_Image;
DROP TABLE IF EXISTS tmp_Product_Image;
DROP TABLE IF EXISTS tmp_Shop_Variation;
DROP TABLE IF EXISTS tmp_Variation;
DROP TABLE IF EXISTS tmp_Variation_Type;
DROP TABLE IF EXISTS tmp_Shop_Discount;
DROP TABLE IF EXISTS tmp_Discount;
DROP TABLE IF EXISTS tmp_Shop_Category;
DROP TABLE IF EXISTS tmp_Category;
DROP TABLE IF EXISTS tmp_Shop_Product_Category;
DROP TABLE IF EXISTS tmp_Product_Category;
DROP TABLE IF EXISTS tmp_Shop_Product_Currency_Region_Link;
DROP TABLE IF EXISTS tmp_Shop_Product_Currency_Link;
DROP TABLE IF EXISTS tmp_User_Role_Link;
DROP TABLE IF EXISTS tmp_Shop_Basket;
DROP TABLE IF EXISTS tmp_Shop_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Supplier_Purchase_Order;
DROP TABLE IF EXISTS tmp_Supplier_Purchase_Order;
DROP TABLE IF EXISTS tmp_Shop_Supplier;
DROP TABLE IF EXISTS tmp_Supplier;
DROP TABLE IF EXISTS tmp_Supplier_Address;
DROP TABLE IF EXISTS tmp_Shop_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS tmp_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS tmp_Shop_Customer;
DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order_Product_Link;
DROP TABLE IF EXISTS tmp_Shop_Customer_Sale_Order;
DROP TABLE IF EXISTS tmp_Get_Variation_From_Csv_Variations;
-- Permanent Tables
DROP TABLE IF EXISTS partsltd_prod.PH_Contact_Form_Temp;
DROP TABLE IF EXISTS partsltd_prod.PH_Contact_Form_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_Contact_Form;
DROP TABLE IF EXISTS partsltd_prod.PH_Contact_Form_Change_Set;
-- Delete old tables
DROP TABLE IF EXISTS Split_Temp;
DROP TABLE IF EXISTS Split_Key_Value_Pair_Csv_Temp;
DROP TABLE IF EXISTS Split_Key_Value_Pair_Temp;
DROP TABLE IF EXISTS partsltd_prod.PH_Calc_User_Temp;
DROP TABLE IF EXISTS Shop_User_Eval_Temp;
DROP TABLE IF EXISTS Shop_Calc_User_Temp;
DROP TABLE IF EXISTS partsltd_prod.PH_User_Role_Link_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_User_Role_Link;
DROP TABLE IF EXISTS Shop_Customer_Sales_Order_Product_Link_Temp;
DROP TABLE IF EXISTS Shop_Customer_Sales_Order_Product_Link_Audit;
DROP TABLE IF EXISTS Shop_Customer_Sales_Order_Product_Link;
DROP TABLE IF EXISTS partsltd_prod.PH_Role_Permission_Link_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_Role_Permission_Link;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Product_Link_Audit;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS partsltd_prod.PH_Role_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_Role;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Product_Link_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Product_Link_Audit;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Product_Link;
DROP TABLE IF EXISTS partsltd_prod.PH_User_Temp;
DROP TABLE IF EXISTS partsltd_prod.PH_User_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_User;
DROP TABLE IF EXISTS Shop_Stock_Item_Temp;
DROP TABLE IF EXISTS Shop_Stock_Item_Audit;
DROP TABLE IF EXISTS Shop_Stock_Item;
DROP TABLE IF EXISTS partsltd_prod.PH_Permission_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_Permission;
DROP TABLE IF EXISTS Shop_Customer_Sales_Order_Audit;
DROP TABLE IF EXISTS Shop_Customer_Sales_Order;
DROP TABLE IF EXISTS partsltd_prod.PH_Permission_Group_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_Permission_Group;
DROP TABLE IF EXISTS Shop_Customer_Temp;
DROP TABLE IF EXISTS Shop_Customer_Audit;
DROP TABLE IF EXISTS Shop_Customer;
DROP TABLE IF EXISTS partsltd_prod.PH_Access_Level_Audit;
DROP TABLE IF EXISTS partsltd_prod.PH_Access_Level;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Temp;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order_Audit;
DROP TABLE IF EXISTS Shop_Manufacturing_Purchase_Order;
DROP TABLE IF EXISTS partsltd_prod.PH_User_Change_Set;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order_Audit;
DROP TABLE IF EXISTS Shop_Supplier_Purchase_Order;
DROP TABLE IF EXISTS partsltd_prod.CORE_Split_Key_Value_Pair_Csv_Temp;
DROP TABLE IF EXISTS partsltd_prod.CORE_Split_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Address_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Address_Audit;
DROP TABLE IF EXISTS Shop_Supplier_Address;
DROP TABLE IF EXISTS partsltd_prod.CORE_Msg_Error_Type;
DROP TABLE IF EXISTS Shop_Supplier_Temp;
DROP TABLE IF EXISTS Shop_Supplier_Audit;
DROP TABLE IF EXISTS Shop_Supplier;
-- Stored Procedures
DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_test_get_many_contact_form;
DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_get_many_contact_form;
DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_test_save_contact_form;
DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_save_contact_form;
DROP TABLE IF EXISTS Shop_User_Order_Product_Link_Audit;
DROP TABLE IF EXISTS Shop_User_Order_Product_Link;
DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_clear_calc_user;
DROP PROCEDURE IF EXISTS partsltd_prod.p_ph_calc_user;
DROP TABLE IF EXISTS Shop_User_Order_Audit;
DROP TABLE IF EXISTS Shop_User_Order;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_clear_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_clear_split;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_split;
DROP PROCEDURE IF EXISTS partsltd_prod.p_clear_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS partsltd_prod.p_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS partsltd_prod.p_clear_split;
DROP PROCEDURE IF EXISTS partsltd_prod.p_split;
DROP TABLE IF EXISTS Shop_User_Order_Status_Audit;
DROP TABLE IF EXISTS Shop_User_Order_Status;
DROP TABLE IF EXISTS Shop_User_Basket_Audit;
DROP TABLE IF EXISTS Shop_User_Basket;
DROP TABLE IF EXISTS Shop_User_Address_Audit;
DROP TABLE IF EXISTS Shop_User_Address;
DROP TABLE IF EXISTS Shop_User_Role_Link_Audit;
DROP TABLE IF EXISTS Shop_User_Role_Link;
DROP TABLE IF EXISTS Shop_User_Temp;
DROP TABLE IF EXISTS Shop_User_Audit;
DROP TABLE IF EXISTS Shop_User;
DROP TABLE IF EXISTS Shop_Role_Permission_Link_Audit;
DROP TABLE IF EXISTS Shop_Role_Permission_Link;
DROP TABLE IF EXISTS Shop_Role_Audit;
DROP TABLE IF EXISTS Shop_Role;
DROP TABLE IF EXISTS Shop_Permission_Audit;
DROP TABLE IF EXISTS Shop_Permission;
DROP TABLE IF EXISTS Shop_Permission_Group_Audit;
DROP TABLE IF EXISTS Shop_Permission_Group;
DROP TABLE IF EXISTS Shop_Discount_Region_Currency_Link_Audit;
DROP TABLE IF EXISTS Shop_Discount_Region_Currency_Link;
DROP TABLE IF EXISTS Shop_Discount_Audit;
DROP TABLE IF EXISTS Shop_Discount;
DROP TABLE IF EXISTS Shop_Product_Permutation_Delivery_Option_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Permutation_Delivery_Option_Link;
DROP TABLE IF EXISTS Shop_Product_Delivery_Option_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Delivery_Option_Link;
DROP TABLE IF EXISTS Shop_Delivery_Option_Audit;
DROP TABLE IF EXISTS Shop_Delivery_Option;
DROP TABLE IF EXISTS Shop_Product_Image_Audit;
DROP TABLE IF EXISTS Shop_Product_Image;
DROP TABLE IF EXISTS Shop_Image_Audit;
DROP TABLE IF EXISTS Shop_Image;
DROP TABLE IF EXISTS Shop_Product_Price_Temp;
DROP TABLE IF EXISTS Shop_Product_Price_Audit;
DROP TABLE IF EXISTS Shop_Product_Price;
DROP TABLE IF EXISTS Shop_Product_Currency_Region_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Currency_Region_Link;
DROP TABLE IF EXISTS Shop_Product_Currency_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Currency_Link;
DROP TABLE IF EXISTS Shop_Product_Variation_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Variation_Link;
DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp;
DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link;
DROP TABLE IF EXISTS Shop_Variation_Temp;
DROP TABLE IF EXISTS Shop_Variation_Audit;
DROP TABLE IF EXISTS Shop_Variation;
DROP TABLE IF EXISTS Shop_Product_Variation_Type_Link_Audit;
DROP TABLE IF EXISTS Shop_Product_Variation_Type_Link;
DROP TABLE IF EXISTS Shop_Product_Variation_Temp;
DROP TABLE IF EXISTS Shop_Product_Variation;
DROP TABLE IF EXISTS Shop_Variation_Type_Temp;
DROP TABLE IF EXISTS Shop_Variation_Type_Audit;
DROP TABLE IF EXISTS Shop_Variation_Type;
DROP TABLE IF EXISTS Shop_Product_Variation_Type_Temp;
DROP TABLE IF EXISTS Shop_Product_Variation_Type;
DROP TABLE IF EXISTS Shop_Product_Permutation_Temp;
DROP TABLE IF EXISTS Shop_Product_Permutation_Audit;
DROP TABLE IF EXISTS Shop_Product_Permutation;
DROP TABLE IF EXISTS Shop_Interval_Recurrence_Audit;
DROP TABLE IF EXISTS Shop_Interval_Recurrence;
DROP TABLE IF EXISTS Shop_Product_Audit;
DROP TABLE IF EXISTS Shop_Product;
DROP TABLE IF EXISTS Shop_Product_Temp;
DROP TABLE IF EXISTS Shop_Product_Category_Temp;
DROP TABLE IF EXISTS Shop_Product_Category_Audit;
DROP TABLE IF EXISTS Shop_Product_Category;
DROP TABLE IF EXISTS Shop_Category_Audit;
DROP TABLE IF EXISTS Shop_Category;
DROP TABLE IF EXISTS Shop_Tax_Or_Surcharge_Temp;
DROP TABLE IF EXISTS Shop_Tax_Or_Surcharge_Audit;
DROP TABLE IF EXISTS Shop_Tax_Or_Surcharge;
DROP TABLE IF EXISTS Shop_Currency_Temp;
DROP TABLE IF EXISTS Shop_Currency_Audit;
DROP TABLE IF EXISTS Shop_Currency;
DROP TABLE IF EXISTS Shop_Storage_Location_Branch_Temp;
DROP TABLE IF EXISTS Shop_Storage_Location_Branch_Audit;
DROP TABLE IF EXISTS Shop_Storage_Location_Branch;
DROP TABLE IF EXISTS Shop_Storage_Location_Temp;
DROP TABLE IF EXISTS Shop_Storage_Location_Audit;
DROP TABLE IF EXISTS Shop_Storage_Location;
DROP TABLE IF EXISTS Shop_Plant_Temp;
DROP TABLE IF EXISTS Shop_Plant_Audit;
DROP TABLE IF EXISTS Shop_Plant;
DROP TABLE IF EXISTS Shop_Address_Audit;
DROP TABLE IF EXISTS Shop_Address;
DROP TABLE IF EXISTS Shop_Delivery_Region_Branch_Audit;
DROP TABLE IF EXISTS Shop_Delivery_Region_Branch;
DROP TABLE IF EXISTS Shop_Region_Branch_Temp;
DROP TABLE IF EXISTS Shop_Region_Branch_Audit;
DROP TABLE IF EXISTS Shop_Region_Branch;
DROP TABLE IF EXISTS Shop_Delivery_Region_Audit;
DROP TABLE IF EXISTS Shop_Delivery_Region;
DROP TABLE IF EXISTS Shop_Region_Temp;
DROP TABLE IF EXISTS Shop_Region_Audit;
DROP TABLE IF EXISTS Shop_Region;
DROP TABLE IF EXISTS Shop_Unit_Measurement_Conversion_Audit;
DROP TABLE IF EXISTS Shop_Unit_Measurement_Conversion;
DROP TABLE IF EXISTS Shop_Unit_Measurement_Audit;
DROP TABLE IF EXISTS Shop_Unit_Measurement;
DROP TABLE IF EXISTS Shop_Image_Type_Audit;
DROP TABLE IF EXISTS Shop_Image_Type;
DROP TABLE IF EXISTS Shop_General_Audit;
DROP TABLE IF EXISTS Shop_General;
DROP TABLE IF EXISTS File_Type_Audit;
DROP TABLE IF EXISTS File_Type;
DROP TABLE IF EXISTS Msg_Error_Type;
DROP TABLE IF EXISTS Shop_Msg_Error_Type;
DROP TABLE IF EXISTS Shop_Access_Level_Audit;
DROP TABLE IF EXISTS Shop_Access_Level;
DROP TABLE IF EXISTS Shop_Sales_And_Purchasing_Change_Set;
DROP TABLE IF EXISTS Shop_User_Change_Set;
DROP TABLE IF EXISTS Shop_Product_Change_Set;
-- Procedures
DROP PROCEDURE IF EXISTS p_split;
DROP PROCEDURE IF EXISTS p_clear_split_temp;
DROP PROCEDURE IF EXISTS p_split_key_value_pair_csv;
DROP PROCEDURE IF EXISTS p_clear_split_key_value_csv_temp;
DROP PROCEDURE IF EXISTS p_clear_split_key_value_pair_csv_temp;
DROP PROCEDURE IF EXISTS p_debug_timing_reporting;
DROP PROCEDURE IF EXISTS p_validate_guid;
DROP PROCEDURE IF EXISTS p_validate_guid_test;
DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_name;
DROP PROCEDURE IF EXISTS p_shop_calc_user;
DROP PROCEDURE IF EXISTS p_shop_calc_user;
DROP PROCEDURE IF EXISTS p_shop_clear_user_eval_temp;
DROP PROCEDURE IF EXISTS p_shop_clear_calc_user;
DROP PROCEDURE IF EXISTS p_shop_get_many_access_level;
DROP PROCEDURE IF EXISTS p_shop_get_many_unit_measurement;
DROP PROCEDURE IF EXISTS p_shop_get_many_region;
DROP PROCEDURE IF EXISTS p_shop_get_many_plant;
DROP PROCEDURE IF EXISTS p_shop_get_many_storage_location;
DROP PROCEDURE IF EXISTS p_shop_get_many_currency;
DROP PROCEDURE IF EXISTS p_shop_save_category;
DROP PROCEDURE IF EXISTS p_shop_save_category_test;
DROP PROCEDURE IF EXISTS p_shop_save_product_category;
DROP PROCEDURE IF EXISTS p_shop_save_product_category_test;
DROP PROCEDURE IF EXISTS p_shop_save_product;
DROP PROCEDURE IF EXISTS p_shop_save_product_test;
DROP PROCEDURE IF EXISTS p_shop_calc_product_permutation;
DROP PROCEDURE IF EXISTS p_shop_clear_calc_product_permutation;
DROP PROCEDURE IF EXISTS p_shop_get_many_product;
DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_product_new;
DROP PROCEDURE IF EXISTS p_shop_save_permutation;
DROP PROCEDURE IF EXISTS p_shop_save_product_permutation;
DROP PROCEDURE IF EXISTS p_shop_save_product_permutation_test;
DROP PROCEDURE IF EXISTS p_shop_save_product_variation;
DROP PROCEDURE IF EXISTS p_shop_save_product_variation_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_product_variation;
DROP FUNCTION IF EXISTS fn_shop_get_id_product_permutation_from_variation_csv_list;
DROP FUNCTION IF EXISTS fn_shop_get_product_variations_from_id_csv_list;
DROP FUNCTION IF EXISTS fn_shop_get_product_permutation_variations_csv;
DROP PROCEDURE IF EXISTS p_shop_save_stock_item;
DROP PROCEDURE IF EXISTS p_shop_save_stock_item_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_stock_item;
DROP PROCEDURE IF EXISTS p_shop_get_many_product_price_and_discount_and_delivery_option;
DROP PROCEDURE IF EXISTS p_shop_get_many_product_price_and_discount_and_delivery_option;
DROP PROCEDURE IF EXISTS p_shop_get_many_stripe_price_new;
DROP PROCEDURE IF EXISTS p_shop_save_user;
DROP PROCEDURE IF EXISTS p_shop_edit_user;
DROP PROCEDURE IF EXISTS p_shop_get_many_user;
DROP PROCEDURE IF EXISTS p_get_many_user;
DROP PROCEDURE IF EXISTS p_shop_get_many_user_basket;
DROP PROCEDURE IF EXISTS p_shop_edit_user_basket;
DROP PROCEDURE IF EXISTS p_shop_save_supplier;
DROP PROCEDURE IF EXISTS p_shop_save_supplier_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_supplier;
DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_supplier_purchase_order_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_supplier_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_manufacturing_purchase_order_test;
DROP PROCEDURE IF EXISTS p_shop_get_many_manufacturing_purchase_order;
DROP PROCEDURE IF EXISTS p_shop_save_customer;
DROP PROCEDURE IF EXISTS p_shop_get_many_customer;
DROP PROCEDURE IF EXISTS p_shop_save_customer_sales_order;
DROP PROCEDURE IF EXISTS p_shop_get_many_customer_sales_order;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_debug_timing_reporting;
DROP PROCEDURE IF EXISTS partsltd_prod.p_debug_timing_reporting;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_validate_guid;
DROP PROCEDURE IF EXISTS partsltd_prod.p_core_validate_guid_test;

View File

@@ -0,0 +1,16 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'CORE_Msg_Error_Type'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.CORE_Msg_Error_Type (
id_type INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, code VARCHAR(50) NOT NULL
, name VARCHAR(500) NOT NULL
, description VARCHAR(1000)
);

View File

@@ -1,13 +0,0 @@
-- Product Change Sets
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Change_Set';
CREATE TABLE Shop_Product_Change_Set (
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
comment VARCHAR(500),
updated_last_on DATETIME,
updated_last_by VARCHAR(100)
);

View File

@@ -1,12 +0,0 @@
-- Split Staging
-- USE partsltd_prod;
-- DROP TABLE IF EXISTS Split_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Split_Temp';
CREATE TABLE Split_Temp (
guid BINARY(36) NOT NULL
, display_order INT NOT NULL
, substring VARCHAR(4000) NOT NULL
);

View File

@@ -1,13 +0,0 @@
-- User Change Sets
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_User_Change_Set';
CREATE TABLE IF NOT EXISTS Shop_User_Change_Set (
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
comment VARCHAR(500),
updated_last_on DATETIME,
updated_last_by VARCHAR(100)
);

View File

@@ -1,13 +0,0 @@
-- Split Key Value Pair CSV Staging
-- USE partsltd_prod;
-- DROP TABLE IF EXISTS Split_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Split_Key_Value_Pair_Csv_Temp';
CREATE TABLE Split_Key_Value_Pair_Csv_Temp (
guid BINARY(36) NOT NULL
, id INT NOT NULL
, key_column VARCHAR(4000) NULL
, value_column VARCHAR(4000) NULL
);

View File

@@ -1,13 +0,0 @@
-- Sales And Purchasing Change Sets
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Sales_And_Purchasing_Change_Set';
CREATE TABLE Shop_Sales_And_Purchasing_Change_Set (
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
comment VARCHAR(500),
updated_last_on DATETIME,
updated_last_by VARCHAR(100)
);

View File

@@ -1,23 +0,0 @@
-- Access Levels
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Access_Level';
CREATE TABLE IF NOT EXISTS Shop_Access_Level (
id_access_level INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50),
name VARCHAR(255),
priority INT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Access_Level_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Access Level Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Access_Level_Audit';
CREATE TABLE IF NOT EXISTS Shop_Access_Level_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_access_level INT NOT NULL,
CONSTRAINT FK_Shop_Access_Level_Audit_id_access_level
FOREIGN KEY (id_access_level)
REFERENCES Shop_Access_Level(id_access_level)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Access_Level_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
);

View File

@@ -1,13 +0,0 @@
-- Error Message Type
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Msg_Error_Type';
CREATE TABLE IF NOT EXISTS Shop_Msg_Error_Type (
id_type INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(500) NOT NULL,
description VARCHAR(1000)
);

View File

@@ -1,17 +0,0 @@
-- File Types
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'File_Type';
CREATE TABLE IF NOT EXISTS File_Type (
id_type INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50),
name VARCHAR(100),
extension VARCHAR(50),
created_on DATETIME,
created_by INT,
updated_last_on DATETIME,
updated_last_by VARCHAR(100)
);

View File

@@ -1,22 +0,0 @@
-- File Type Audit
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'File_Type_Audit';
CREATE TABLE IF NOT EXISTS File_Type_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_type INT NOT NULL,
CONSTRAINT FK_File_Type_Audit_id_type
FOREIGN KEY (id_type)
REFERENCES File_Type(id_type)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
created_on DATETIME,
created_by INT,
updated_last_on DATETIME,
updated_last_by VARCHAR(100)
);

View File

@@ -1,17 +0,0 @@
-- Generic / shared properties
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_General';
CREATE TABLE IF NOT EXISTS Shop_General (
id_general INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
quantity_max FLOAT,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT CHK_Shop_General_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Shop General Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_General_Audit';
CREATE TABLE IF NOT EXISTS Shop_General_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_general INT NOT NULL,
CONSTRAINT FK_Shop_General_Audit_id_general
FOREIGN KEY (id_general)
REFERENCES Shop_General(id_general)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_General_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,27 +0,0 @@
-- Image Types
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Image_Type';
CREATE TABLE IF NOT EXISTS Shop_Image_Type (
id_type INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
/*
id_type_file INT NOT NULL,
CONSTRAINT FK_Shop_Image_Type_id_type_file
FOREIGN KEY (id_type_file)
REFERENCES File_Type(id_type),
*/
code VARCHAR(50),
name VARCHAR(255),
name_plural VARCHAR(256),
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Image_Type_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Image Type Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Image_Type_Audit';
CREATE TABLE IF NOT EXISTS Shop_Image_Type_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_type INT NOT NULL,
CONSTRAINT FK_Shop_Image_Type_Audit_id_type
FOREIGN KEY (id_type)
REFERENCES Shop_Image_Type(id_type)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Image_Type_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,15 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'CORE_Split_Temp'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.CORE_Split_Temp (
guid BINARY(36) NOT NULL
, display_order INT NOT NULL
, substring VARCHAR(4000) NOT NULL
);

View File

@@ -0,0 +1,16 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'CORE_Split_Key_Value_Pair_Csv_Temp'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.CORE_Split_Key_Value_Pair_Csv_Temp (
guid BINARY(36) NOT NULL
, id INT NOT NULL
, key_column VARCHAR(4000) NULL
, value_column VARCHAR(4000) NULL
);

View File

@@ -0,0 +1,16 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_User_Change_Set'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_User_Change_Set (
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, comment VARCHAR(500)
, updated_last_on DATETIME
, id_user_updated_last_by INT
);

View File

@@ -1,18 +0,0 @@
-- Regions
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region';
CREATE TABLE IF NOT EXISTS Shop_Region (
id_region INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(200) NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Region_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Region Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region_Audit';
CREATE TABLE IF NOT EXISTS Shop_Region_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_region INT NOT NULL,
CONSTRAINT FK_Shop_Region_Audit_id_region
FOREIGN KEY (id_region)
REFERENCES Shop_Region(id_region)
ON UPDATE RESTRICT,
name_field VARCHAR(64) NOT NULL,
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Region_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,20 +0,0 @@
-- Region Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region_Temp';
CREATE TABLE IF NOT EXISTS Shop_Region_Temp (
id_region INT NOT NULL PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(200) NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Region_Temp_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,29 +0,0 @@
-- Region Branchs
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region_Branch';
CREATE TABLE IF NOT EXISTS Shop_Region_Branch (
id_branch INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_region_parent INT NOT NULL,
CONSTRAINT FK_Shop_Region_Branch_id_region_parent
FOREIGN KEY (id_region_parent)
REFERENCES Shop_Region(id_region)
ON UPDATE RESTRICT,
id_region_child INT NOT NULL,
CONSTRAINT FK_Shop_Region_Branch_id_region_child
FOREIGN KEY (id_region_child)
REFERENCES Shop_Region(id_region)
ON UPDATE RESTRICT,
-- depth INT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Region_Branch_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,20 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Access_Level'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Access_Level (
id_access_level INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, code VARCHAR(50)
, name VARCHAR(255)
, priority INT NOT NULL
, display_order INT NOT NULL
, active BIT NOT NULL DEFAULT 1
);

View File

@@ -1,22 +0,0 @@
-- Region Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region_Branch_Audit';
CREATE TABLE IF NOT EXISTS Shop_Region_Branch_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_branch INT NOT NULL,
CONSTRAINT FK_Shop_Region_Branch_Audit_id_branch
FOREIGN KEY (id_branch)
REFERENCES Shop_Region_Branch(id_branch)
ON UPDATE RESTRICT,
name_field VARCHAR(64) NOT NULL,
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Region_Branch_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,15 +0,0 @@
-- Region Branch Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Region_Branch_Temp';
CREATE TABLE IF NOT EXISTS Shop_Region_Branch_Temp (
id_branch INT NOT NULL PRIMARY KEY,
id_region_parent INT NOT NULL,
id_region_child INT NOT NULL,
-- depth INT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL
);

View File

@@ -1,31 +0,0 @@
-- Addresses
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Address';
CREATE TABLE Shop_Address (
id_address INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_region INT NOT NULL
, CONSTRAINT FK_Shop_Address_id_region
FOREIGN KEY (id_region)
REFERENCES partsltd_prod.Shop_Region(id_region)
/*
, id_supplier INT NULL
, CONSTRAINT FK_Shop_Address_id_supplier
FOREIGN KEY (id_supplier)
REFERENCES partsltd_prod.Shop_Supplier(id_supplier)
*/
, postcode VARCHAR(20) NOT NULL
, address_line_1 VARCHAR(256) NOT NULL
, address_line_2 VARCHAR(256) NOT NULL
, city VARCHAR(256) NOT NULL
, county VARCHAR(256) NOT NULL
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, created_by INT
, id_change_set INT
, CONSTRAINT FK_Shop_Address_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.Shop_User_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Plant
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Plant';
CREATE TABLE IF NOT EXISTS Shop_Plant (
id_plant INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(500) NOT NULL,
id_address INT NOT NULL,
CONSTRAINT FK_Shop_Plant_id_address
FOREIGN KEY (id_address)
REFERENCES Shop_Address(id_address),
id_user_manager INT NOT NULL,
active BIT NOT NULL DEFAULT 1,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Plant_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,21 +0,0 @@
-- Address Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Address_Audit';
CREATE TABLE IF NOT EXISTS Shop_Address_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_address INT NOT NULL,
CONSTRAINT FK_Shop_Address_Audit_id_address
FOREIGN KEY (id_address)
REFERENCES Shop_Address(id_address)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Address_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,22 +0,0 @@
-- Plant Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Plant_Audit';
CREATE TABLE IF NOT EXISTS Shop_Plant_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_plant INT NOT NULL,
CONSTRAINT FK_Shop_Plant_Audit_id_plant
FOREIGN KEY (id_plant)
REFERENCES Shop_Plant(id_plant)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Plant_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,17 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Permission_Group'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Permission_Group (
id_group INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, code VARCHAR(50)
, name VARCHAR(255)
, display_order INT NOT NULL
, active BIT NOT NULL DEFAULT 1
);

View File

@@ -1,16 +0,0 @@
-- Plant Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Plant_Temp';
CREATE TABLE IF NOT EXISTS Shop_Plant_Temp (
id_plant INT NOT NULL PRIMARY KEY
, code VARCHAR(50) NOT NULL
, name VARCHAR(500) NOT NULL
, id_address INT NOT NULL
, id_user_manager INT NOT NULL
, active BIT NOT NULL DEFAULT 1
, guid BINARY(36) NOT NULL
);

View File

@@ -1,23 +0,0 @@
-- Storage Location
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Storage_Location';
CREATE TABLE IF NOT EXISTS Shop_Storage_Location (
id_location INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_plant INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_id_plant
FOREIGN KEY (id_plant)
REFERENCES Shop_Plant(id_plant),
code VARCHAR(50) NOT NULL,
name VARCHAR(500) NOT NULL,
active BIT NOT NULL DEFAULT 1,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Storage_Location_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Storage Location Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Storage_Location_Audit';
CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_location INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_Audit_id_location
FOREIGN KEY (id_location)
REFERENCES Shop_Storage_Location(id_location)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,13 +0,0 @@
-- Storage Location Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Storage_Location_Temp';
CREATE TABLE IF NOT EXISTS Shop_Storage_Location (
id_location INT NOT NULL PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(500) NOT NULL,
active BIT NOT NULL DEFAULT 1
);

View File

@@ -0,0 +1,25 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Permission'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Permission (
id_permission INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, code VARCHAR(50)
, name VARCHAR(255)
, id_permission_group INT NOT NULL
, CONSTRAINT FK_PH_Permission_id_permission_group
FOREIGN KEY (id_permission_group)
REFERENCES partsltd_prod.PH_Permission_Group(id_group)
, id_access_level_required INT NOT NULL
, CONSTRAINT FK_PH_Permission_id_access_level_required
FOREIGN KEY (id_access_level_required)
REFERENCES partsltd_prod.PH_Access_Level(id_access_level)
, display_order INT NOT NULL
, active BIT NOT NULL DEFAULT 1
);

View File

@@ -1,29 +0,0 @@
-- Storage Location Branch
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Storage_Location_Branch';
CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch (
id_branch INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_location_parent INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_Branch_id_location_parent
FOREIGN KEY (id_location_parent)
REFERENCES Shop_Storage_Location(id_location)
ON UPDATE RESTRICT,
id_location_child INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_Branch_id_location_child
FOREIGN KEY (id_location_child)
REFERENCES Shop_Storage_Location(id_location)
ON UPDATE RESTRICT,
-- depth INT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Storage_Location_Branch_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Storage Location Branch Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Storage_Location_Branch_Audit';
CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_branch INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_Branch_Audit_id_branch
FOREIGN KEY (id_branch)
REFERENCES Shop_Storage_Location_Branch(id_branch)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Storage_Location_Branch_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,15 +0,0 @@
-- Storage Location Branch Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Storage_Location_Branch_Temp';
CREATE TABLE IF NOT EXISTS Shop_Storage_Location_Branch_Temp (
id_branch INT NOT NULL PRIMARY KEY,
id_location_parent INT NOT NULL,
id_location_child INT NOT NULL,
-- depth INT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL
);

View File

@@ -1,23 +0,0 @@
-- Currencies
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Currency';
CREATE TABLE IF NOT EXISTS Shop_Currency (
id_currency INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(255) NOT NULL,
symbol VARCHAR(50) NOT NULL,
factor_from_GBP FLOAT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Currency_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -0,0 +1,29 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_User'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_User (
id_user INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_user_auth0 VARCHAR(200)
, firstname VARCHAR(255)
, surname VARCHAR(255)
, email VARCHAR(254)
, is_email_verified BIT NOT NULL DEFAULT 0
, is_super_user BIT NOT NULL DEFAULT 0
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, id_user_created_by INT
, CONSTRAINT FK_PH_User_id_user_created_by
FOREIGN KEY (id_user_created_by)
REFERENCES partsltd_prod.PH_User(id_user)
, id_change_set INT
, CONSTRAINT FK_PH_User_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Currency Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Currency_Audit';
CREATE TABLE IF NOT EXISTS Shop_Currency_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_currency INT NOT NULL,
CONSTRAINT FK_Shop_Currency_Audit_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Currency_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,16 +0,0 @@
-- Currency Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Currency_Temp';
CREATE TABLE IF NOT EXISTS Shop_Currency_Temp (
id_currency INT NOT NULL PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(255) NOT NULL,
symbol VARCHAR(1) NOT NULL,
factor_from_GBP FLOAT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL
);

View File

@@ -0,0 +1,24 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_User_Audit'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_User_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_user INT NOT NULL
, CONSTRAINT FK_PH_User_Audit_id_user
FOREIGN KEY (id_user)
REFERENCES partsltd_prod.PH_User(id_user)
, name_field VARCHAR(50) NOT NULL
, value_prev VARCHAR(500)
, value_new VARCHAR(500)
, id_change_set INT NOT NULL
, CONSTRAINT FK_PH_User_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -1,38 +0,0 @@
-- Taxes and Surcharges
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Tax_Or_Surcharge';
CREATE TABLE Shop_Tax_Or_Surcharge (
id_tax INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(200) NOT NULL,
id_region_buyer INT NOT NULL,
CONSTRAINT FK_Shop_Tax_Or_Surcharge_id_region_buyer
FOREIGN KEY (id_region_buyer)
REFERENCES Shop_Region(id_region),
id_region_seller INT NOT NULL,
CONSTRAINT FK_Shop_Tax_Or_Surcharge_id_region_seller
FOREIGN KEY (id_region_seller)
REFERENCES Shop_Region(id_region),
id_currency INT,
CONSTRAINT FK_Shop_Tax_Or_Surcharge_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency)
ON UPDATE RESTRICT,
fixed_fee FLOAT NOT NULL DEFAULT 0,
multiplier FLOAT NOT NULL DEFAULT 1 CHECK (multiplier > 0),
apply_fixed_fee_before_multiplier BIT DEFAULT 1,
quantity_min FLOAT NOT NULL DEFAULT 0,
quantity_max FLOAT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Tax_Or_Surcharge_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,22 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_User_Temp'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_User_Temp (
id_temp INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_user INT NOT NULL
, id_user_auth0 VARCHAR(200)
, firstname VARCHAR(255)
, surname VARCHAR(255)
, email VARCHAR(254)
, is_email_verified BIT
, is_super_user BIT
, active BIT
, guid BINARY(36) NOT NULL
);

View File

@@ -1,23 +0,0 @@
-- Tax Or Surcharge Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Tax_Or_Surcharge_Audit';
CREATE TABLE IF NOT EXISTS Shop_Tax_Or_Surcharge_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_tax INT NOT NULL,
CONSTRAINT FK_Shop_Tax_Or_Surcharge_Audit_id_discount
FOREIGN KEY (id_tax)
REFERENCES Shop_Tax_Or_Surcharge(id_tax)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Tax_Or_Surcharge_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -0,0 +1,26 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Role'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Role (
id_role INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, code VARCHAR(50)
, name VARCHAR(255)
, display_order INT NOT NULL
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, id_user_created_by INT
, CONSTRAINT FK_PH_Role_id_user_created_by
FOREIGN KEY (id_user_created_by)
REFERENCES partsltd_prod.PH_User(id_user)
, id_change_set INT
, CONSTRAINT FK_PH_Role_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Taxes and Surcharges Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Tax_Or_Surcharge_Temp';
CREATE TABLE Shop_Tax_Or_Surcharge_Temp (
id_tax INT NOT NULL PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(200) NOT NULL,
id_region_buyer INT NOT NULL,
id_region_seller INT NOT NULL,
id_currency INT,
fixed_fee FLOAT NOT NULL DEFAULT 0,
multiplier FLOAT NOT NULL DEFAULT 1 CHECK (multiplier > 0),
apply_fixed_fee_before_multiplier BIT DEFAULT 1,
quantity_min FLOAT NOT NULL DEFAULT 0,
quantity_max FLOAT NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL
);

View File

@@ -0,0 +1,24 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Role_Audit'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Role_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_role INT NOT NULL
, CONSTRAINT FK_PH_Role_Audit_id_role
FOREIGN KEY (id_role)
REFERENCES partsltd_prod.PH_Role(id_role)
, name_field VARCHAR(50) NOT NULL
, value_prev VARCHAR(500)
, value_new VARCHAR(500)
, id_change_set INT NOT NULL
, CONSTRAINT FK_PH_Role_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -1,26 +0,0 @@
-- Unit of Measurement
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Unit_Measurement';
CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement (
id_unit_measurement INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name_singular VARCHAR(255) NOT NULL,
name_plural VARCHAR(256) NOT NULL,
symbol VARCHAR(50) NOT NULL,
symbol_is_suffix_not_prefix BIT NOT NULL DEFAULT 1,
is_base_unit BIT NOT NULL DEFAULT 0,
is_unit_of_distance BIT NOT NULL DEFAULT 0,
is_unit_of_mass BIT NOT NULL DEFAULT 0,
is_unit_of_time BIT NOT NULL DEFAULT 0,
is_unit_of_volume BIT NOT NULL DEFAULT 0,
active BIT NOT NULL DEFAULT 1,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Unit_Measurement_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Unit of Measurement Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Unit_Measurement_Audit';
CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_unit_measurement INT NOT NULL,
CONSTRAINT FK_Shop_Unit_Measurement_Audit_id_unit_measurement
FOREIGN KEY (id_unit_measurement)
REFERENCES Shop_Unit_Measurement(id_unit_measurement)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Unit_Measurement_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,35 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Role_Permission_Link'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Role_Permission_Link (
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_role INT NOT NULL
, CONSTRAINT FK_PH_Role_Permission_Link_id_role
FOREIGN KEY (id_role)
REFERENCES partsltd_prod.PH_Role(id_role)
, id_permission INT NOT NULL
, CONSTRAINT FK_PH_Role_Permission_Link_id_permission
FOREIGN KEY (id_permission)
REFERENCES partsltd_prod.PH_Permission(id_permission)
, id_access_level INT NOT NULL
, CONSTRAINT FK_PH_Role_Permission_Link_id_access_level
FOREIGN KEY (id_access_level)
REFERENCES partsltd_prod.PH_Access_Level(id_access_level)
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, id_user_created_by INT
, CONSTRAINT FK_PH_Role_Permission_Link_id_user_created_by
FOREIGN KEY (id_user_created_by)
REFERENCES partsltd_prod.PH_User(id_user)
, id_change_set INT
, CONSTRAINT FK_PH_Role_Permission_Link_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Unit of Measurement Conversion
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Unit_Measurement_Conversion';
CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Conversion (
id_conversion INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
id_unit_derived INT NOT NULL,
id_unit_base INT NOT NULL,
multiplier_unit_base FLOAT NOT NULL,
increment_unit_base FLOAT NOT NULL,
apply_multiplier_before_increment BIT NOT NULL DEFAULT 1,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Unit_Measurement_Conversion_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,23 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Role_Permission_Link_Audit';
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Role_Permission_Link_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_link INT NOT NULL
, CONSTRAINT FK_PH_Role_Permission_Link_Audit_id_link
FOREIGN KEY (id_link)
REFERENCES partsltd_prod.PH_Role_Permission_Link(id_link)
, name_field VARCHAR(50) NOT NULL
, value_prev VARCHAR(500)
, value_new VARCHAR(500)
, id_change_set INT NOT NULL
, CONSTRAINT FK_PH_Role_Permission_Link_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Unit of Measurement Conversion Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Unit_Measurement_Conversion_Audit';
CREATE TABLE IF NOT EXISTS Shop_Unit_Measurement_Conversion_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_conversion INT NOT NULL,
CONSTRAINT FK_Shop_Unit_Measurement_Conversion_Audit_id_conversion
FOREIGN KEY (id_conversion)
REFERENCES Shop_Unit_Measurement_Conversion(id_conversion)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Unit_Measurement_Conversion_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,31 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_User_Role_Link'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_User_Role_Link (
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_user INT NOT NULL
, CONSTRAINT FK_PH_User_Role_Link_id_user
FOREIGN KEY (id_user)
REFERENCES partsltd_prod.PH_User(id_user)
, id_role INT NOT NULL
, CONSTRAINT FK_PH_User_Role_Link_id_role
FOREIGN KEY (id_role)
REFERENCES partsltd_prod.PH_Role(id_role)
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, id_user_created_by INT
, CONSTRAINT FK_PH_User_Role_Link_id_user_created_by
FOREIGN KEY (id_user_created_by)
REFERENCES partsltd_prod.PH_User(id_user)
, id_change_set INT
, CONSTRAINT FK_PH_User_Role_Link_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,24 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_User_Role_Link_Audit'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_User_Role_Link_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_link INT NOT NULL
, CONSTRAINT FK_PH_User_Role_Link_Audit_id_link
FOREIGN KEY (id_link)
REFERENCES partsltd_prod.PH_User_Role_Link(id_link)
, name_field VARCHAR(50) NOT NULL
, value_prev VARCHAR(500)
, value_new VARCHAR(500)
, id_change_set INT NOT NULL
, CONSTRAINT FK_PH_User_Role_Link_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_User_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,22 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Calc_User_Temp'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Calc_User_Temp (
guid BINARY(36) NOT NULL
, id_user INT
, id_permission_required INT NOT NULL
, CONSTRAINT FK_PH_Calc_User_Temp_id_permission_required
FOREIGN KEY (id_permission_required)
REFERENCES partsltd_prod.PH_Permission (id_permission)
, priority_access_level_required INT NOT NULL
, is_super_user BIT
, priority_access_level_user INT
, has_access BIT
);

View File

@@ -0,0 +1,19 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Contact_Form_Change_Set'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Contact_Form_Change_Set (
id_change_set INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, comment VARCHAR(500)
, updated_last_on DATETIME
, id_user_updated_last_by INT
, CONSTRAINT FK_PH_Role_id_user_updated_last_by
FOREIGN KEY (id_user_updated_last_by)
REFERENCES partsltd_prod.PH_User(id_user)
);

View File

@@ -1,24 +0,0 @@
-- Categories
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category';
CREATE TABLE IF NOT EXISTS Shop_Product_Category (
id_category INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, code VARCHAR(50)
, name VARCHAR(255)
, description VARCHAR(4000)
, active BIT NOT NULL DEFAULT 1
, display_order INT NOT NULL
, id_access_level_required INT NOT NULL
, CONSTRAINT FK_Shop_Product_Category_id_access_level_required
FOREIGN KEY (id_access_level_required)
REFERENCES Shop_Access_Level(id_access_level)
, created_on DATETIME
, created_by INT NOT NULL
, id_change_set INT
, CONSTRAINT FK_Shop_Product_Category_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,28 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Contact_Form'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Contact_Form (
id_contact_form INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, email VARCHAR(255) NOT NULL
, name_contact VARCHAR(255) NOT NULL
, name_company VARCHAR(255) NOT NULL
, message TEXT NOT NULL
, receive_marketing_communications BIT NOT NULL DEFAULT 0
, active BIT NOT NULL DEFAULT 1
, created_on DATETIME
, id_user_created_by INT
, CONSTRAINT FK_PH_Contact_Form_id_user_created_by
FOREIGN KEY (id_user_created_by)
REFERENCES partsltd_prod.PH_User(id_user)
, id_change_set INT
, CONSTRAINT FK_PH_Contact_Form_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_Contact_Form_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Category Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Category_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_category INT NOT NULL,
CONSTRAINT FK_Shop_Product_Category_Audit_id_category
FOREIGN KEY (id_category)
REFERENCES Shop_Product_Category(id_category)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Product_Category_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -0,0 +1,24 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Contact_Form_Audit'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Contact_Form_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_contact_form INT NOT NULL
, CONSTRAINT FK_PH_Contact_Form_Audit_id_contact_form
FOREIGN KEY (id_contact_form)
REFERENCES partsltd_prod.PH_Contact_Form(id_contact_form)
, name_field VARCHAR(50) NOT NULL
, value_prev TEXT
, value_new TEXT
, id_change_set INT NOT NULL
, CONSTRAINT FK_PH_Contact_Form_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.PH_Contact_Form_Change_Set(id_change_set)
);

View File

@@ -1,21 +0,0 @@
-- Categories Temp
-- DROP TABLE Shop_Product_Category_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Category_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Category_Temp (
id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_category INT NOT NULL
, code VARCHAR(50) NOT NULL
, name VARCHAR(255) NOT NULL
, description VARCHAR(4000) NULL
, id_access_level_required INT NOT NULL DEFAULT 1
, display_order INT NOT NULL
, active BIT NULL
, can_view BIT NULL
, can_edit BIT NULL
, can_admin BIT NULL
, guid BINARY(36) NOT NULL
);

View File

@@ -0,0 +1,21 @@
USE partsltd_prod;
SELECT CONCAT('WARNING: Table ', TABLE_SCHEMA, '.', TABLE_NAME, ' already exists.') AS msg_warning
FROM INFORMATION_SCHEMA.TABLES
WHERE
TABLE_SCHEMA = 'partsltd_prod'
AND TABLE_NAME = 'PH_Contact_Form_Temp'
;
CREATE TABLE IF NOT EXISTS partsltd_prod.PH_Contact_Form_Temp (
id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_contact_form INT
, email VARCHAR(255)
, name_contact VARCHAR(255)
, name_company VARCHAR(255)
, message TEXT
, receive_marketing_communications BIT
, active BIT
, guid BINARY(36)
);

View File

@@ -1,48 +0,0 @@
-- Products
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product';
CREATE TABLE IF NOT EXISTS Shop_Product (
id_product INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
-- description VARCHAR(4000),
id_category INT NOT NULL,
has_variations BIT NOT NULL,
/*
price_GBP_full FLOAT,
price_GBP_min FLOAT,
-- ratio_discount_overall FLOAT NOT NULL DEFAULT 0,
CONSTRAINT FK_Shop_Product_id_category
FOREIGN KEY (id_category)
REFERENCES Shop_Product_Category(id_category)
ON UPDATE RESTRICT,
latency_manuf INT,
quantity_min FLOAT,
quantity_max FLOAT,
quantity_step FLOAT,
quantity_stock FLOAT,
is_subscription BIT,
id_unit_measurement_interval_recurrence INT,
CONSTRAINT FK_Shop_Product_id_unit_measurement_interval_recurrence
FOREIGN KEY (id_unit_measurement_interval_recurrence)
REFERENCES Shop_Interval_Recurrence(id_interval),
count_interval_recurrence INT,
*/
id_access_level_required INT NOT NULL,
CONSTRAINT FK_Shop_Product_id_access_level_required
FOREIGN KEY (id_access_level_required)
REFERENCES Shop_Access_Level(id_access_level),
-- id_stripe_product VARCHAR(100),
-- id_stripe_price VARCHAR(100) NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME NOT NULL,
created_by INT NOT NULL,
id_change_set INT,
CONSTRAINT FK_Shop_Product_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Products
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_product INT NOT NULL,
CONSTRAINT FK_Shop_Product_Audit_id_product
FOREIGN KEY (id_product)
REFERENCES Shop_Product(id_product)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Product_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,21 +0,0 @@
-- Products Temp
-- DROP TABLE IF EXISTS Shop_Product_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Temp (
id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_product INT NOT NULL
, name VARCHAR(255) NOT NULL
, id_category INT NOT NULL
, has_variations BIT NOT NULL
, id_access_level_required INT NOT NULL
, display_order INT NOT NULL
, active BIT NOT NULL DEFAULT 1
, can_view BIT NULL DEFAULT NULL
, can_edit BIT NULL DEFAULT NULL
, can_admin BIT NULL DEFAULT NULL
, guid BINARY(36) NOT NULL
);

View File

@@ -1,61 +0,0 @@
-- Product Permutation
-- DROP TABLE partsltd_prod.Shop_Product_Permutation;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation (
id_permutation INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permutation_temp INT NOT NULL,
id_product INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_id_product
FOREIGN KEY (id_product)
REFERENCES Shop_Product(id_product)
ON UPDATE RESTRICT,
-- name VARCHAR(255) NOT NULL,
description VARCHAR(4000) NOT NULL,
cost_local_VAT_excl FLOAT NULL,
cost_local_VAT_incl FLOAT NULL,
id_currency_cost INT NOT NULL,
profit_local_min FLOAT NULL,
-- id_currency_profit_min INT NOT NULL,
latency_manufacture INT NOT NULL,
id_unit_measurement_quantity INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_id_unit_quantity
FOREIGN KEY (id_unit_measurement_quantity)
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
count_unit_measurement_per_quantity_step FLOAT NOT NULL,
quantity_min FLOAT NULL,
quantity_max FLOAT NULL,
quantity_stock FLOAT NOT NULL,
is_subscription BIT NOT NULL,
id_unit_measurement_interval_recurrence INT,
CONSTRAINT FK_Shop_Product_Permutation_id_unit_interval_recurrence
FOREIGN KEY (id_unit_measurement_interval_recurrence)
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
/*
CONSTRAINT CHECK_FK_Shop_Product_Permutation_id_unit_measurement_interval_recurrence
CHECK (id_unit_measurement_interval_recurrence IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)),
*/
count_interval_recurrence INT,
id_stripe_product VARCHAR(100) NULL,
does_expire_faster_once_unsealed BIT NOT NULL DEFAULT 0,
id_unit_measurement_interval_expiration_unsealed INT,
CONSTRAINT FK_Shop_Product_Permutation_id_unit_interval_expiration_unsealed
FOREIGN KEY (id_unit_measurement_interval_expiration_unsealed)
REFERENCES Shop_Unit_Measurement(id_unit_measurement),
/*
CONSTRAINT CHECK_FK_Shop_Product_Permutation_id_interval_expiration_unsealed
CHECK (id_interval_expiration_unsealed IN (SELECT id_unit_measurement FROM Shop_Unit_Measurement WHERE is_unit_of_time = 1)),
*/
count_interval_expiration_unsealed INT,
active BIT NOT NULL DEFAULT 1,
-- display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Product_Permutation_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Product Permutation Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permutation INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_Audit_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,37 +0,0 @@
-- Product Permutation Temp
-- DROP TABLE IF EXISTS Shop_Product_Permutation_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Temp (
id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_permutation INT NOT NULL
, id_product INT NOT NULL
, csv_id_pairs_variation VARCHAR(4000) NULL
, description VARCHAR(4000) NOT NULL
, cost_local_VAT_excl FLOAT NULL
, cost_local_VAT_incl FLOAT NULL
, id_currency_cost INT NOT NULL
, profit_local_min FLOAT NULL
, latency_manufacture INT NOT NULL
, id_unit_measurement_quantity INT NOT NULL
, count_unit_measurement_per_quantity_step FLOAT NOT NULL
, quantity_min FLOAT NULL
, quantity_max FLOAT NULL
, quantity_stock FLOAT NULL
, is_subscription BIT NOT NULL
, id_unit_measurement_interval_recurrence INT
, count_interval_recurrence INT
, id_stripe_product VARCHAR(100) NULL
, does_expire_faster_once_unsealed BIT NOT NULL DEFAULT 0
, id_unit_measurement_interval_expiration_unsealed INT
, count_interval_expiration_unsealed INT
, active BIT NOT NULL DEFAULT 1
-- display_order INT NOT NULL
, guid BINARY(36)
, can_view BIT NULL DEFAULT NULL
, can_edit BIT NULL DEFAULT NULL
, can_admin BIT NULL DEFAULT NULL
);

View File

@@ -1,22 +0,0 @@
-- Variation Types
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Type';
CREATE TABLE IF NOT EXISTS Shop_Variation_Type (
id_type INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_type_temp INT NULL
, code VARCHAR(50)
, name VARCHAR(255)
, name_plural VARCHAR(256)
, active BIT NOT NULL DEFAULT 1
, display_order INT NOT NULL
, created_on DATETIME
, created_by INT
, id_change_set INT
, CONSTRAINT FK_Shop_Variation_Type_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Variation Type Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Type_Audit';
CREATE TABLE IF NOT EXISTS Shop_Variation_Type_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_type INT NOT NULL,
CONSTRAINT FK_Shop_Variation_Type_Audit_id_type
FOREIGN KEY (id_type)
REFERENCES Shop_Variation_Type(id_type)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Variation_Type_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,20 +0,0 @@
-- Variation Types Temp
-- DROP TABLE partsltd_prod.Shop_Variation_Type_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Type_Temp';
CREATE TABLE IF NOT EXISTS Shop_Variation_Type_Temp (
id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_type INT NOT NULL
-- , id_type_temp INT NOT NULL
, code VARCHAR(50)
, name VARCHAR(255)
, name_plural VARCHAR(256)
, active BIT NULL
, display_order INT NOT NULL
, created_on DATETIME
, created_by INT
, guid BINARY(36) NOT NULL
);

View File

@@ -1,30 +0,0 @@
-- Variations
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation';
CREATE TABLE Shop_Variation (
id_variation INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_type INT NOT NULL
, CONSTRAINT FK_Shop_Variation_id_type
FOREIGN KEY (id_type)
REFERENCES partsltd_prod.Shop_Variation_Type(id_type)
ON UPDATE RESTRICT
, id_unit_measurement INT NULL
, CONSTRAINT FK_Shop_Unit_Measurement_id_unit_measurement
FOREIGN KEY (id_unit_measurement)
REFERENCES partsltd_prod.Shop_Unit_Measurement(id_unit_measurement)
, count_unit_measurement INT NULL
, code VARCHAR(50)
, name VARCHAR(255)
, active BIT NOT NULL DEFAULT 1
, display_order INT NOT NULL
, created_on DATETIME
, created_by INT
, id_change_set INT
, CONSTRAINT FK_Shop_Variation_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES partsltd_prod.Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Variation Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Audit';
CREATE TABLE IF NOT EXISTS Shop_Variation_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_variation INT NOT NULL,
CONSTRAINT FK_Shop_Variation_Audit_id_variation
FOREIGN KEY (id_variation)
REFERENCES Shop_Variation(id_variation)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Variation_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,21 +0,0 @@
-- Variations Temp
-- DROP TABLE partsltd_prod.Shop_Variation_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Variation_Temp';
CREATE TABLE Shop_Variation_Temp (
id_temp INT NOT NULL PRIMARY KEY AUTO_INCREMENT
, id_variation INT NOT NULL
, id_type INT NOT NULL
, id_unit_measurement INT NULL
, count_unit_measurement INT NULL
, code VARCHAR(50)
, name VARCHAR(255)
, active BIT
, display_order INT NOT NULL
, created_on DATETIME
, created_by INT
, guid BINARY(36)
);

View File

@@ -1,28 +0,0 @@
-- Product Permutation Variation Link
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Variation_Link';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link (
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permutation INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation)
ON UPDATE RESTRICT,
id_variation INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_id_variation
FOREIGN KEY (id_variation)
REFERENCES Shop_Variation(id_variation)
ON UPDATE RESTRICT,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Product Permutation Variation Link Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Variation_Link_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_link INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_Audit_id_link
FOREIGN KEY (id_link)
REFERENCES Shop_Product_Permutation_Variation_Link(id_link)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Product_Permutation_Variation_Link_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,16 +0,0 @@
-- Product Permutation Variation Link
-- DROP TABLE IF EXISTS Shop_Product_Permutation_Variation_Link_Temp;
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Variation_Link_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Variation_Link_Temp (
id_temp INT NOT NULL AUTO_INCREMENT PRIMARY KEY
, id_link INT NOT NULL
, id_permutation INT NOT NULL
, id_variation INT NOT NULL
, active BIT NOT NULL
, display_order INT NOT NULL
, GUID BINARY(36) NOT NULL
);

View File

@@ -1,32 +0,0 @@
-- Product Price
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Price';
CREATE TABLE IF NOT EXISTS Shop_Product_Price (
id_price INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permutation INT NULL,
CONSTRAINT FK_Shop_Product_Price_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation),
id_currency INT NOT NULL,
CONSTRAINT FK_Shop_Product_Price_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency),
id_region_purchase INT NOT NULL,
CONSTRAINT FK_Shop_Product_Price_id_region_purchase
FOREIGN KEY (id_region_purchase)
REFERENCES Shop_Region(id_region),
price_local_VAT_incl FLOAT NULL,
price_local_VAT_excl FLOAT NULL,
id_stripe_price VARCHAR(200),
active BIT NOT NULL DEFAULT 1,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Product_Price_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Product Price Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Price_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Price_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_price INT NOT NULL,
CONSTRAINT FK_Shop_Product_Price_Audit_id_price
FOREIGN KEY (id_price)
REFERENCES Shop_Product_Price(id_price)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Product_Price_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,17 +0,0 @@
-- Product Price Temp
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Price_Temp';
CREATE TABLE IF NOT EXISTS Shop_Product_Price_Temp (
id_price INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permutation INT NULL,
id_currency INT NOT NULL,
id_region_purchase INT NOT NULL,
price_local_VAT_incl FLOAT NULL,
price_local_VAT_excl FLOAT NULL,
id_stripe_price VARCHAR(200),
active BIT NOT NULL DEFAULT 1
);

View File

@@ -1,27 +0,0 @@
-- Product Permutation Images
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Image';
CREATE TABLE IF NOT EXISTS Shop_Product_Image (
id_image INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_type_image INT NOT NULL,
CONSTRAINT FK_Shop_Product_Image_id_type_image
FOREIGN KEY (id_type_image)
REFERENCES Shop_Image_Type(id_type),
id_permutation INT NULL,
CONSTRAINT FK_Shop_Product_Image_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation),
url VARCHAR(255),
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Product_Image_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,21 +0,0 @@
-- Product Image Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Image_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Image_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_image INT NOT NULL,
CONSTRAINT FK_Shop_Product_Image_Audit_id_image
FOREIGN KEY (id_image)
REFERENCES Shop_Product_Image(id_image),
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Product_Image_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,27 +0,0 @@
-- Delivery Options
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Delivery_Option';
CREATE TABLE IF NOT EXISTS Shop_Delivery_Option (
id_option INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(100) NOT NULL,
description VARCHAR(4000),
latency_delivery_min INT NOT NULL,
latency_delivery_max INT NOT NULL,
/*
quantity_min INT NOT NULL,
quantity_max INT NOT NULL,
*/
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Delivery_Option_Type_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Delivery Option Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Delivery_Option_Audit';
CREATE TABLE IF NOT EXISTS Shop_Delivery_Option_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_option INT NOT NULL,
CONSTRAINT FK_Shop_Delivery_Option_Audit_id_option
FOREIGN KEY (id_option)
REFERENCES Shop_Delivery_Option(id_option)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Delivery_Option_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,46 +0,0 @@
-- Delivery Option
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Delivery_Option_Link';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Delivery_Option_Link (
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_product INT NOT NULL,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_id_product
FOREIGN KEY (id_product)
REFERENCES Shop_Product(id_product)
ON UPDATE RESTRICT,
id_permutation INT,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation)
ON UPDATE RESTRICT,
id_delivery_option INT NOT NULL,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_id_delivery_option
FOREIGN KEY (id_delivery_option)
REFERENCES Shop_Delivery_Option(id_option)
ON UPDATE RESTRICT,
id_region INT NOT NULL,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_id_region
FOREIGN KEY (id_region)
REFERENCES Shop_Region(id_region)
ON UPDATE RESTRICT,
id_currency INT NOT NULL,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency)
ON UPDATE RESTRICT,
price_local FLOAT NOT NULL,
quantity_min FLOAT NULL,
quantity_max FLOAT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,22 +0,0 @@
-- Delivery Option Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Product_Permutation_Delivery_Option_Link_Audit';
CREATE TABLE IF NOT EXISTS Shop_Product_Permutation_Delivery_Option_Link_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_link INT NOT NULL,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_Audit_id_link
FOREIGN KEY (id_link)
REFERENCES Shop_Product_Permutation_Delivery_Option_Link(id_link)
ON UPDATE RESTRICT,
name_field VARCHAR(64) NOT NULL,
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Permutation_Delivery_Option_Link_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,48 +0,0 @@
-- Discounts
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Discount';
CREATE TABLE Shop_Discount (
id_discount INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50) NOT NULL,
name VARCHAR(200) NOT NULL,
id_product INT NOT NULL,
CONSTRAINT FK_Shop_Discount_id_product
FOREIGN KEY (id_product)
REFERENCES Shop_Product(id_product),
id_permutation INT,
CONSTRAINT FK_Shop_Discount_id_permutation
FOREIGN KEY (id_permutation)
REFERENCES Shop_Product_Permutation(id_permutation)
ON UPDATE RESTRICT,
/*
id_delivery_region INT,
CONSTRAINT FK_Shop_Discount_id_delivery_region
FOREIGN KEY (id_delivery_region)
REFERENCES Shop_Delivery_Region(id_region)
ON UPDATE RESTRICT,
id_currency INT,
CONSTRAINT FK_Shop_Discount_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency)
ON UPDATE RESTRICT,
*/
multiplier FLOAT NOT NULL DEFAULT 1 CHECK (multiplier > 0),
subtractor FLOAT NOT NULL DEFAULT 0,
apply_multiplier_first BIT DEFAULT 1,
quantity_min FLOAT NOT NULL DEFAULT 0,
quantity_max FLOAT NOT NULL,
date_start DATETIME NOT NULL,
date_end DATETIME NOT NULL,
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Discount_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Discount Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Discount_Audit';
CREATE TABLE IF NOT EXISTS Shop_Discount_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_discount INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Audit_id_discount
FOREIGN KEY (id_discount)
REFERENCES Shop_Discount(id_discount)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,32 +0,0 @@
-- Discount Region Currency Link
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Discount_Region_Currency_Link';
CREATE TABLE IF NOT EXISTS Shop_Discount_Region_Currency_Link (
id_link INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_discount INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_id_discount
FOREIGN KEY (id_discount)
REFERENCES Shop_Discount(id_discount)
ON UPDATE RESTRICT,
id_region INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_id_region
FOREIGN KEY (id_region)
REFERENCES Shop_Region(id_region)
ON UPDATE RESTRICT,
id_currency INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_id_currency
FOREIGN KEY (id_currency)
REFERENCES Shop_Currency(id_currency)
ON UPDATE RESTRICT,
active BIT NOT NULL DEFAULT 1,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Discount Region Currency Link Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Discount_Region_Currency_Link_Audit';
CREATE TABLE IF NOT EXISTS Shop_Discount_Region_Currency_Link_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_link INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_Audit_id_link
FOREIGN KEY (id_link)
REFERENCES Shop_Discount_Region_Currency_Link(id_link)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Discount_Region_Currency_Link_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_Product_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,21 +0,0 @@
-- Permission Groups
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Permission_Group';
CREATE TABLE IF NOT EXISTS Shop_Permission_Group (
id_group INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50),
name VARCHAR(255),
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Permission_Group_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,23 +0,0 @@
-- Permission Group Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Permission_Group_Audit';
CREATE TABLE IF NOT EXISTS Shop_Permission_Group_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_group INT NOT NULL,
CONSTRAINT FK_Shop_Permission_Group_Audit_id_group
FOREIGN KEY (id_group)
REFERENCES Shop_Permission_Group(id_group)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Permission_Group_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,29 +0,0 @@
-- Permissions
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Permission';
CREATE TABLE IF NOT EXISTS Shop_Permission (
id_permission INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50),
name VARCHAR(255),
id_permission_group INT NOT NULL,
CONSTRAINT FK_Shop_Permission_id_permission_group
FOREIGN KEY (id_permission_group)
REFERENCES Shop_Permission_Group(id_group)
ON UPDATE RESTRICT,
id_access_level_required INT NOT NULL,
CONSTRAINT FK_Shop_Permission_id_access_level_required
FOREIGN KEY (id_access_level_required)
REFERENCES Shop_Access_Level(id_access_level),
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Permission_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
);

View File

@@ -1,23 +0,0 @@
-- Permission Audits
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Permission_Audit';
CREATE TABLE IF NOT EXISTS Shop_Permission_Audit (
id_audit INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
id_permission INT NOT NULL,
CONSTRAINT FK_Shop_Permission_Audit_id_permission
FOREIGN KEY (id_permission)
REFERENCES Shop_Permission(id_permission)
ON UPDATE RESTRICT,
name_field VARCHAR(50),
value_prev VARCHAR(500),
value_new VARCHAR(500),
id_change_set INT NOT NULL,
CONSTRAINT FK_Shop_Permission_Audit_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
ON UPDATE RESTRICT
);

View File

@@ -1,20 +0,0 @@
-- Roles
SELECT CONCAT('WARNING: Table ', TABLE_NAME, ' already exists.') AS msg_warning FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'Shop_Role';
CREATE TABLE IF NOT EXISTS Shop_Role (
id_role INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(50),
name VARCHAR(255),
active BIT NOT NULL DEFAULT 1,
display_order INT NOT NULL,
created_on DATETIME,
created_by INT,
id_change_set INT,
CONSTRAINT FK_Shop_Role_id_change_set
FOREIGN KEY (id_change_set)
REFERENCES Shop_User_Change_Set(id_change_set)
);

Some files were not shown because too many files have changed in this diff Show More