1. PostgreSQL copy of all MySQL created and tested.\n 2. Purchase Orders and Sales Orders and stock level management added to MySQL, PostgreSQL, and server and front end code.
This commit is contained in:
48
static/PostgreSQL/130.4_tbl_Shop_Discount.sql
Normal file
48
static/PostgreSQL/130.4_tbl_Shop_Discount.sql
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
-- 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 INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
|
||||
code VARCHAR(50) NOT NULL,
|
||||
name VARCHAR(200) NOT NULL,
|
||||
id_product INTEGER NOT NULL,
|
||||
CONSTRAINT FK_Shop_Discount_id_product
|
||||
FOREIGN KEY (id_product)
|
||||
REFERENCES Shop_Product(id_product),
|
||||
id_permutation INTEGER,
|
||||
CONSTRAINT FK_Shop_Discount_id_permutation
|
||||
FOREIGN KEY (id_permutation)
|
||||
REFERENCES Shop_Product_Permutation(id_permutation)
|
||||
ON UPDATE RESTRICT,
|
||||
/*
|
||||
id_delivery_region INTEGER,
|
||||
CONSTRAINT FK_Shop_Discount_id_delivery_region
|
||||
FOREIGN KEY (id_delivery_region)
|
||||
REFERENCES Shop_Delivery_Region(id_region)
|
||||
ON UPDATE RESTRICT,
|
||||
id_currency INTEGER,
|
||||
CONSTRAINT FK_Shop_Discount_id_currency
|
||||
FOREIGN KEY (id_currency)
|
||||
REFERENCES Shop_Currency(id_currency)
|
||||
ON UPDATE RESTRICT,
|
||||
*/
|
||||
multiplier REAL NOT NULL DEFAULT 1 CHECK (multiplier > 0),
|
||||
subtractor REAL NOT NULL DEFAULT 0,
|
||||
apply_multiplier_first BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
quantity_min REAL NOT NULL DEFAULT 0,
|
||||
quantity_max REAL NOT NULL,
|
||||
date_start TIMESTAMP NOT NULL,
|
||||
date_end TIMESTAMP NOT NULL,
|
||||
active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
display_order INTEGER NOT NULL,
|
||||
created_on TIMESTAMP,
|
||||
created_by VARCHAR(100),
|
||||
id_change_set INTEGER,
|
||||
CONSTRAINT FK_Shop_Discount_id_change_set
|
||||
FOREIGN KEY (id_change_set)
|
||||
REFERENCES Shop_Product_Change_Set(id_change_set)
|
||||
);
|
||||
Reference in New Issue
Block a user