diff --git a/demos/ecommerce/source_00_design.md b/demos/ecommerce/source_00_design.md index 15b651d0a..b5df68a3e 100644 --- a/demos/ecommerce/source_00_design.md +++ b/demos/ecommerce/source_00_design.md @@ -207,10 +207,10 @@ C##INVENTORY.PRODUCTS BRAND BIGINT nullable fk C##INVENTORY.BRANDS.ID CATEGORY VARCHAR nullable | ex: "Phones" SUBCATEGORY VARCHAR nullable | ex: "Smartphones" - WIDTH FLOAT | typical width of the product, see PRODUCT_VERSIONS for the real one - LENGTH FLOAT | typical length of the product, see PRODUCT_VERSIONS for the real one - HEIGHT FLOAT | typical height of the product, see PRODUCT_VERSIONS for the real one - WEIGHT FLOAT | typical weight of the product, see PRODUCT_VERSIONS for the real one + WIDTH FLOAT | typical width of the product in millis, see PRODUCT_VERSIONS for the real one + LENGTH FLOAT | typical length of the product in millis, see PRODUCT_VERSIONS for the real one + HEIGHT FLOAT | typical height of the product in millis, see PRODUCT_VERSIONS for the real one + WEIGHT FLOAT | typical weight of the product in grams, see PRODUCT_VERSIONS for the real one REMARKS TEXT nullable | ex: fragile CREATED_AT TIMESTAMP UPDATED_AT TIMESTAMP @@ -223,10 +223,10 @@ C##INVENTORY.PRODUCT_VERSIONS EAN VARCHAR(13) unique | european id NAME VARCHAR unique | ex: "Pixel 8 Pro Menthe 128 Go" SPECS JSON | specificities of this version, ex: `{color: "Menthe", storage: 128}` - WIDTH FLOAT - LENGTH FLOAT - HEIGHT FLOAT - WEIGHT FLOAT + WIDTH FLOAT | in millis + LENGTH FLOAT | in millis + HEIGHT FLOAT | in millis + WEIGHT FLOAT | in grams REMARKS TEXT nullable CREATED_AT TIMESTAMP UPDATED_AT TIMESTAMP @@ -630,10 +630,11 @@ billing.Payments shipping.Carriers id bigint unique=pk registration varchar - cargoWidth float - cargoLength float - cargoHeight float - cargoWeight float + licensePlate varchar + cargoWidth float | inner cargo width in millimeters + cargoLength float | inner cargo length in millimeters + cargoHeight float | inner cargo height in millimeters + cargoWeight float | maximum weight for the cargo, in kilograms createdAt timestamp createdBy bigint nullable fk identity.Users.id updatedAt timestamp @@ -660,7 +661,7 @@ shipping.ShipmentItems invoiceId bigint fk billing.InvoiceLines.InvoiceId invoiceLine int fk billing.InvoiceLines.Index deliveredAt timestamp nullable - deliveredTo bigint nullable fk identity.Users.id + deliveredTo bigint nullable fk identity.Users.id | the User who got the delivered package # CRM diff --git a/demos/ecommerce/source_03_inventory_oracle.sql b/demos/ecommerce/source_03_inventory_oracle.sql index 7b5086d33..6a4bac101 100644 --- a/demos/ecommerce/source_03_inventory_oracle.sql +++ b/demos/ecommerce/source_03_inventory_oracle.sql @@ -8,17 +8,18 @@ GRANT UNLIMITED TABLESPACE TO C##INVENTORY; CREATE ROLE C##INVENTORY_ROLE; GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE VIEW, CREATE MATERIALIZED VIEW, CREATE TYPE, CREATE TRIGGER to C##inventory_role; GRANT C##INVENTORY_ROLE TO C##INVENTORY; +ALTER SESSION SET current_schema = C##INVENTORY; CREATE TABLE C##INVENTORY.EMPLOYEES ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, - FIRST_NAME VARCHAR2(255), - LAST_NAME VARCHAR2(255), + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + FIRST_NAME VARCHAR2(255) NOT NULL, + LAST_NAME VARCHAR2(255) NOT NULL, EMAIL VARCHAR2(255), PHONE VARCHAR2(20), - CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - CREATED_BY NUMBER, - UPDATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - UPDATED_BY NUMBER, + CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, + CREATED_BY NUMBER NOT NULL, + UPDATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, + UPDATED_BY NUMBER NOT NULL, DELETED_AT TIMESTAMP, DELETED_BY NUMBER ); @@ -27,7 +28,7 @@ CREATE INDEX IDX_EMPLOYEES_EMAIL ON C##INVENTORY.EMPLOYEES (EMAIL); CREATE INDEX IDX_EMPLOYEES_DELETED_AT ON C##INVENTORY.EMPLOYEES (DELETED_AT); CREATE TABLE C##INVENTORY.WAREHOUSES ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, NAME VARCHAR2(255) UNIQUE, ADDRESS CLOB, MANAGER NUMBER REFERENCES C##INVENTORY.EMPLOYEES (ID), @@ -41,7 +42,7 @@ CREATE TABLE C##INVENTORY.WAREHOUSES ( CREATE INDEX IDX_WAREHOUSES_DELETED_AT ON C##INVENTORY.WAREHOUSES (DELETED_AT); CREATE TABLE C##INVENTORY.HALLS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, WAREHOUSE_ID NUMBER REFERENCES C##INVENTORY.WAREHOUSES (ID), NAME VARCHAR2(255), MANAGER NUMBER REFERENCES C##INVENTORY.EMPLOYEES (ID), @@ -55,7 +56,7 @@ CREATE TABLE C##INVENTORY.HALLS ( CREATE INDEX IDX_HALLS_DELETED_AT ON C##INVENTORY.HALLS (DELETED_AT); CREATE TABLE C##INVENTORY.AISLES ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, HALL_ID NUMBER REFERENCES C##INVENTORY.HALLS (ID), NAME VARCHAR2(255), MANAGER NUMBER REFERENCES C##INVENTORY.EMPLOYEES (ID), @@ -69,7 +70,7 @@ CREATE TABLE C##INVENTORY.AISLES ( CREATE INDEX IDX_AISLES_DELETED_AT ON C##INVENTORY.AISLES (DELETED_AT); CREATE TABLE C##INVENTORY.RACKS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, AISLE_ID NUMBER REFERENCES C##INVENTORY.AISLES (ID), NAME VARCHAR2(255), CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -82,7 +83,7 @@ CREATE TABLE C##INVENTORY.RACKS ( CREATE INDEX IDX_RACKS_DELETED_AT ON C##INVENTORY.RACKS (DELETED_AT); CREATE TABLE C##INVENTORY.SHELVES ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, RACK_ID NUMBER REFERENCES C##INVENTORY.RACKS (ID), NAME VARCHAR2(255), CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -95,7 +96,7 @@ CREATE TABLE C##INVENTORY.SHELVES ( CREATE INDEX IDX_SHELVES_DELETED_AT ON C##INVENTORY.SHELVES (DELETED_AT); CREATE TABLE C##INVENTORY.SHELF_POSITIONS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, SHELF_ID NUMBER REFERENCES C##INVENTORY.SHELVES (ID), NAME VARCHAR2(255), CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -136,7 +137,7 @@ CREATE TABLE C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS ( COMMENT ON TABLE C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS IS 'how to check the employee is identified, can be several'; CREATE TABLE C##INVENTORY.BRANDS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, SLUG VARCHAR2(255) UNIQUE, NAME VARCHAR2(255) UNIQUE, CREATED_AT TIMESTAMP DEFAULT CURRENT_TIMESTAMP, @@ -148,7 +149,7 @@ COMMENT ON COLUMN C##INVENTORY.BRANDS.SLUG IS 'ex: "google"'; COMMENT ON COLUMN C##INVENTORY.BRANDS.NAME IS 'ex: "Google"'; CREATE TABLE C##INVENTORY.PRODUCTS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, SLUG VARCHAR2(255) UNIQUE, NAME VARCHAR2(255) UNIQUE, BRAND NUMBER REFERENCES C##INVENTORY.BRANDS (ID), @@ -168,14 +169,14 @@ COMMENT ON COLUMN C##INVENTORY.PRODUCTS.SLUG IS 'ex: "pixel-8-pro"'; COMMENT ON COLUMN C##INVENTORY.PRODUCTS.NAME IS 'ex: "Pixel 8 Pro"'; COMMENT ON COLUMN C##INVENTORY.PRODUCTS.CATEGORY IS 'ex: "Phones"'; COMMENT ON COLUMN C##INVENTORY.PRODUCTS.SUBCATEGORY IS 'ex: "Smartphones"'; -COMMENT ON COLUMN C##INVENTORY.PRODUCTS.WIDTH IS 'typical width of the product, see PRODUCT_VERSIONS for the real one'; -COMMENT ON COLUMN C##INVENTORY.PRODUCTS.LENGTH IS 'typical length of the product, see PRODUCT_VERSIONS for the real one'; -COMMENT ON COLUMN C##INVENTORY.PRODUCTS.HEIGHT IS 'typical height of the product, see PRODUCT_VERSIONS for the real one'; -COMMENT ON COLUMN C##INVENTORY.PRODUCTS.WEIGHT IS 'typical weight of the product, see PRODUCT_VERSIONS for the real one'; +COMMENT ON COLUMN C##INVENTORY.PRODUCTS.WIDTH IS 'typical width of the product in millis, see PRODUCT_VERSIONS for the real one'; +COMMENT ON COLUMN C##INVENTORY.PRODUCTS.LENGTH IS 'typical length of the product in millis, see PRODUCT_VERSIONS for the real one'; +COMMENT ON COLUMN C##INVENTORY.PRODUCTS.HEIGHT IS 'typical height of the product in millis, see PRODUCT_VERSIONS for the real one'; +COMMENT ON COLUMN C##INVENTORY.PRODUCTS.WEIGHT IS 'typical weight of the product in grams, see PRODUCT_VERSIONS for the real one'; COMMENT ON COLUMN C##INVENTORY.PRODUCTS.REMARKS IS 'ex: fragile'; CREATE TABLE C##INVENTORY.PRODUCT_VERSIONS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, PRODUCT_ID NUMBER REFERENCES C##INVENTORY.PRODUCTS (ID), SKU VARCHAR2(12) UNIQUE, EAN VARCHAR2(13) UNIQUE, @@ -195,9 +196,13 @@ COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.SKU IS 'internal id'; COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.EAN IS 'european id'; COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.NAME IS 'ex: "Pixel 8 Pro Menthe 128 Go"'; COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.SPECS IS 'specificities of this version, ex: `{color: "Menthe", storage: 128}`'; +COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.WIDTH IS 'in millis'; +COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.LENGTH IS 'in millis'; +COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.HEIGHT IS 'in millis'; +COMMENT ON COLUMN C##INVENTORY.PRODUCT_VERSIONS.WEIGHT IS 'in grams'; CREATE TABLE C##INVENTORY.PHYSICAL_PRODUCTS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, PRODUCT_VERSION_ID NUMBER REFERENCES C##INVENTORY.PRODUCT_VERSIONS (ID), SNID VARCHAR2(12) UNIQUE, EXPIRATION TIMESTAMP, @@ -212,7 +217,7 @@ COMMENT ON COLUMN C##INVENTORY.PHYSICAL_PRODUCTS.SNID IS 'serial number of this COMMENT ON COLUMN C##INVENTORY.PHYSICAL_PRODUCTS.EXPIRATION IS 'when Product has an expiration date, null otherwise'; CREATE TABLE C##INVENTORY.SUPPLIERS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, NAME VARCHAR2(255), "LEVEL" NUMBER, CURRENCY VARCHAR2(3), @@ -222,7 +227,7 @@ CREATE TABLE C##INVENTORY.SUPPLIERS ( ); CREATE INDEX IDX_SUPPLIERS_NAME ON C##INVENTORY.SUPPLIERS (NAME); CREATE INDEX IDX_SUPPLIERS_DELETED_AT ON C##INVENTORY.SUPPLIERS (DELETED_AT); -COMMENT ON COLUMN C##INVENTORY.SUPPLIERS.LEVEL IS 'the lower, the more priority is given to this supplier'; +COMMENT ON COLUMN C##INVENTORY.SUPPLIERS."LEVEL" IS 'the lower, the more priority is given to this supplier'; CREATE TABLE C##INVENTORY.SUPPLIER_PRICES ( SUPPLIER_ID NUMBER REFERENCES C##INVENTORY.SUPPLIERS (ID), @@ -252,7 +257,7 @@ CREATE TABLE C##INVENTORY.SUPPLIER_EMPLOYEES ( CREATE INDEX IDX_SUPPLIER_EMPLOYEES_DELETED_AT ON C##INVENTORY.SUPPLIER_EMPLOYEES (DELETED_AT); CREATE TABLE C##INVENTORY.PURCHASE_ORDERS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, SUPPLIER_ID NUMBER REFERENCES C##INVENTORY.SUPPLIERS (ID), PRICE FLOAT, CURRENCY VARCHAR2(3), @@ -287,12 +292,12 @@ CREATE TABLE C##INVENTORY.PURCHASE_ORDER_ITEMS ( ); CREATE TABLE C##INVENTORY.DELIVERIES ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, - REASON VARCHAR2(255), - ACCEPTED CHAR(1) CHECK (ACCEPTED IN ('Y', 'N')), + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, + REASON VARCHAR2(255) NOT NULL, + ACCEPTED CHAR(1) NOT NULL CHECK (ACCEPTED IN ('Y', 'N')), PURCHASE_ORDER_ID NUMBER REFERENCES C##INVENTORY.PURCHASE_ORDERS (ID), - WAREHOUSE_ID NUMBER, - WAREHOUSE_EMPLOYEE_ID NUMBER, + WAREHOUSE_ID NUMBER NOT NULL, + WAREHOUSE_EMPLOYEE_ID NUMBER NOT NULL, SUPPLIER_ID NUMBER, SUPPLIER_EMPLOYEE_ID NUMBER, DELIVERED_AT TIMESTAMP, @@ -307,7 +312,7 @@ CREATE TABLE C##INVENTORY.DELIVERY_ITEMS ( ); CREATE TABLE C##INVENTORY.PICKUPS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, REASON VARCHAR2(255), ACCEPTED CHAR(1) CHECK (ACCEPTED IN ('Y', 'N')), WAREHOUSE_ID NUMBER, @@ -326,7 +331,7 @@ CREATE TABLE C##INVENTORY.PICKUP_ITEMS ( ); CREATE TABLE C##INVENTORY.INVENTORIES ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, NAME VARCHAR2(255), WAREHOUSE_ID NUMBER REFERENCES C##INVENTORY.WAREHOUSES (ID), HALL_ID NUMBER REFERENCES C##INVENTORY.HALLS (ID), @@ -348,7 +353,7 @@ CREATE TABLE C##INVENTORY.INVENTORY_MEMBERS ( ); CREATE TABLE C##INVENTORY.INVENTORY_OBSERVATIONS ( - ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, + ID NUMBER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, INVENTORY_ID NUMBER REFERENCES C##INVENTORY.INVENTORIES (ID), PHYSICAL_PRODUCT_ID NUMBER REFERENCES C##INVENTORY.PHYSICAL_PRODUCTS (ID), STATUS VARCHAR2(255), @@ -364,77 +369,255 @@ CREATE INDEX IDX_INVENTORY_OBSERVATIONS_DELETED_AT ON C##INVENTORY.INVENTORY_OBS -- insert some data -INSERT INTO C##INVENTORY.EMPLOYEES (FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES ('John', 'Doe', 'john.doe@example.com', '1234567890', 1, 1); -INSERT INTO C##INVENTORY.EMPLOYEES (FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES ('Jane', 'Smith', 'jane.smith@example.com', '0987654321', 1, 1); - -INSERT INTO C##INVENTORY.WAREHOUSES (NAME, ADDRESS, MANAGER, CREATED_BY, UPDATED_BY) VALUES ('Main Warehouse', '1234 Warehouse St.', 1, 1, 1); -INSERT INTO C##INVENTORY.WAREHOUSES (NAME, ADDRESS, MANAGER, CREATED_BY, UPDATED_BY) VALUES ('Secondary Warehouse', '5678 Warehouse Ave.', 2, 1, 1); - -INSERT INTO C##INVENTORY.HALLS (WAREHOUSE_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (1, 'Hall A', 1, 1, 1); -INSERT INTO C##INVENTORY.HALLS (WAREHOUSE_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (2, 'Hall B', 2, 1, 1); - -INSERT INTO C##INVENTORY.AISLES (HALL_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (1, 'Aisle 1', 1, 1, 1); -INSERT INTO C##INVENTORY.AISLES (HALL_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (2, 'Aisle 2', 2, 1, 1); - -INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (1, 'Rack 1', 1, 1); -INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (2, 'Rack 2', 1, 1); - -INSERT INTO C##INVENTORY.SHELVES (RACK_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (1, 'Shelf 1', 1, 1); -INSERT INTO C##INVENTORY.SHELVES (RACK_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (2, 'Shelf 2', 1, 1); - -INSERT INTO C##INVENTORY.SHELF_POSITIONS (SHELF_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (1, 'Position 1', 1, 1); -INSERT INTO C##INVENTORY.SHELF_POSITIONS (SHELF_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (2, 'Position 2', 1, 1); - -INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 'manager', 1, 1); -INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 2, 'stocker', 1, 1); - -INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, CREATED_BY) VALUES (1, 1, 'badge', '123456', 1); -INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, CREATED_BY) VALUES (2, 2, 'cni', '987654', 1); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (1, 'Harry', 'Potter', 'harry.potter@hogwarts.ac.uk', '+1-202-555-0173', 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (2, 'Hermione', 'Granger', 'hermione.granger@hogwarts.ac.uk', '+44-20-7946-0958', 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (3, 'Ron', 'Weasley', 'ron.weasley@hogwarts.ac.uk', '+33-1-45-67-89-01', 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (4, 'Albus', 'Dumbledore', 'albus.dumbledore@hogwarts.ac.uk', '+49-30-1234567', 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (5, 'Severus', 'Snape', 'severus.snape@hogwarts.ac.uk', '+61-2-9374-4000', 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (6, 'Frodo', 'Baggins', 'frodo.baggins@shire.me', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (7, 'Samwise', 'Gamgee', 'samwise.gamgee@shire.me', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (8, 'Gandalf', 'the Grey', 'gandalf@middleearth.me', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (9, 'Aragorn', 'Elessar', 'aragorn@middleearth.me', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (10, 'Legolas', 'Greenleaf', 'legolas@woodlandrealm.me', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (11, 'Gimli', 'Son of Glóin', 'gimli@lonelymountain.me', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (12, 'Steve', 'Rogers', 'steve.rogers@avengers.com', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (13, 'Bruce', 'Banner', 'bruce.banner@avengers.com', NULL, 3, 3); +INSERT INTO C##INVENTORY.EMPLOYEES (ID, FIRST_NAME, LAST_NAME, EMAIL, PHONE, CREATED_BY, UPDATED_BY) VALUES (14, 'Natasha', 'Romanoff', 'natasha.romanoff@shield.gov', NULL, 3, 3); + +INSERT INTO C##INVENTORY.WAREHOUSES (NAME, ADDRESS, MANAGER, CREATED_BY, UPDATED_BY) VALUES ('Hogwarts Central Warehouse', 'Hogwarts School of Witchcraft and Wizardry, Highlands, Scotland', 4, 16, 16); +INSERT INTO C##INVENTORY.WAREHOUSES (NAME, ADDRESS, MANAGER, CREATED_BY, UPDATED_BY) VALUES ('Shire Storage Facility', 'The Shire, Westfarthing, Middle-earth', 8, 20, 20); + +INSERT INTO C##INVENTORY.HALLS (WAREHOUSE_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (1, 'Main Hall', 4, 16, 16); +INSERT INTO C##INVENTORY.HALLS (WAREHOUSE_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (1, 'Potion Storage', 5, 16, 16); + +INSERT INTO C##INVENTORY.AISLES (HALL_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (1, 'Wand Aisle', 2, 16, 16); +INSERT INTO C##INVENTORY.AISLES (HALL_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (1, 'Book Aisle', 2, 16, 16); +INSERT INTO C##INVENTORY.AISLES (HALL_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (2, 'Ingredients Aisle', 3, 16, 16); +INSERT INTO C##INVENTORY.AISLES (HALL_ID, NAME, MANAGER, CREATED_BY, UPDATED_BY) VALUES (2, 'Cauldron Aisle', 3, 16, 16); + +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (1, 'Phoenix Feather Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (1, 'Dragon Heartstring Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (2, 'Ancient Texts Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (2, 'Modern Spellbooks Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (3, 'Herbs Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (3, 'Potions Ingredients Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (4, 'Small Cauldrons Rack', 16, 16); +INSERT INTO C##INVENTORY.RACKS (AISLE_ID, NAME, CREATED_BY, UPDATED_BY) VALUES (4, 'Large Cauldrons Rack', 16, 16); + +BEGIN + FOR rack IN (SELECT ID FROM C##INVENTORY.RACKS) LOOP + FOR i IN 1..3 LOOP + DECLARE + v_shelf_id NUMBER; + BEGIN + INSERT INTO C##INVENTORY.SHELVES (RACK_ID, NAME, CREATED_BY, UPDATED_BY) + VALUES (rack.ID, CASE WHEN i = 1 THEN 'Top Shelf' WHEN i = 2 THEN 'Middle Shelf' ELSE 'Bottom Shelf' END, 16, 16) + RETURNING ID INTO v_shelf_id; + + FOR j IN 1..3 LOOP + INSERT INTO C##INVENTORY.SHELF_POSITIONS (SHELF_ID, NAME, CREATED_BY, UPDATED_BY) + VALUES (v_shelf_id, CASE WHEN j = 1 THEN 'Position A' WHEN j = 2 THEN 'Position B' ELSE 'Position C' END, 16, 16); + END LOOP; + END; + END LOOP; + END LOOP; +END; + +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 'stocker', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 2, 'stocker', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 3, 'loader', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 4, 'manager', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 5, 'receiver', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 6, 'stocker', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 7, 'stocker', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 8, 'manager', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 9, 'receiver', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 10, 'loader', 3, 3); +INSERT INTO C##INVENTORY.WAREHOUSE_EMPLOYEES (WAREHOUSE_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 11, 'loader', 3, 3); + +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 1, 'name', 'Harry Potter', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 1, 'badge', 'HP1234', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 1, 'cni', '01 23 45 678 901', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 2, 'badge', 'HG5678', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 2, 'cni', '02 34 56 789 012', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 3, 'badge', 'RW9101', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 3, 'cni', '03 45 67 890 123', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 4, 'badge', 'AD1213', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 4, 'cni', '04 56 78 901 234', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 5, 'badge', 'SS1415', NULL, 16); +INSERT INTO C##INVENTORY.WAREHOUSE_IDENTITY_PROOFS (WAREHOUSE_ID, EMPLOYEES_ID, KIND, VALUE, EXPIRE, CREATED_BY) VALUES (1, 5, 'cni', '05 67 89 012 345', NULL, 16); INSERT INTO C##INVENTORY.BRANDS (SLUG, NAME) VALUES ('google', 'Google'); INSERT INTO C##INVENTORY.BRANDS (SLUG, NAME) VALUES ('apple', 'Apple'); -INSERT INTO C##INVENTORY.PRODUCTS (SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES ('pixel-8-pro', 'Pixel 8 Pro', 1, 'Phones', 'Smartphones', 2.8, 5.8, 0.3, 0.5); -INSERT INTO C##INVENTORY.PRODUCTS (SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES ('iphone-14', 'iPhone 14', 2, 'Phones', 'Smartphones', 2.7, 5.7, 0.3, 0.4); - -INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (1, 'P8P128', '1234567890123', 'Pixel 8 Pro Menthe 128 Go', '{"color": "Menthe", "storage": 128}', 2.8, 5.8, 0.3, 0.5); -INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (2, 'I14128', '1234567890124', 'iPhone 14 Bleu 128 Go', '{"color": "Bleu", "storage": 128}', 2.7, 5.7, 0.3, 0.4); - -INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (PRODUCT_VERSION_ID, SNID, EXPIRATION) VALUES (1, 'SN1234567890', TO_TIMESTAMP('2025-12-31 23:59:59', 'YYYY-MM-DD HH24:MI:SS')); -INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (PRODUCT_VERSION_ID, SNID) VALUES (1, 'SN1234567891'); - -INSERT INTO C##INVENTORY.SUPPLIERS (NAME, "LEVEL", CURRENCY) VALUES ('Supplier A', 1, 'USD'); -INSERT INTO C##INVENTORY.SUPPLIERS (NAME, "LEVEL", CURRENCY) VALUES ('Supplier B', 2, 'EUR'); - -INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 1, 70.00); -INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 2, 80.00); - -INSERT INTO C##INVENTORY.SUPPLIER_EMPLOYEES (SUPPLIER_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 'delivery', 1, 1); -INSERT INTO C##INVENTORY.SUPPLIER_EMPLOYEES (SUPPLIER_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 2, 'sale', 1, 1); - -INSERT INTO C##INVENTORY.PURCHASE_ORDERS (SUPPLIER_ID, PRICE, CURRENCY, DETAILS, NOTES, CREATED_BY, UPDATED_BY) VALUES (1, 700.00, 'USD', 'Order details for Supplier A', 'Internal notes', 1, 1); -INSERT INTO C##INVENTORY.PURCHASE_ORDERS (SUPPLIER_ID, PRICE, CURRENCY, DETAILS, NOTES, CREATED_BY, UPDATED_BY) VALUES (2, 800.00, 'EUR', 'Order details for Supplier B', 'Internal notes', 1, 1); - -INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 10, 70.00, 1, 1); -INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 2, 5, 160.00, 1, 1); - -INSERT INTO C##INVENTORY.DELIVERIES (REASON, ACCEPTED, PURCHASE_ORDER_ID, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('supplier_delivery', 'Y', 1, 1, 1, 1, 1, CURRENT_TIMESTAMP); -INSERT INTO C##INVENTORY.DELIVERIES (REASON, ACCEPTED, PURCHASE_ORDER_ID, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('customer_return', 'N', 2, 2, 2, 2, 2, CURRENT_TIMESTAMP); - +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (1, 'pixel-8', 'Pixel 8', 1, 'Phones', 'Smartphones', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (1, 1, 'GGLPX8O128', '0840244706692', 'Pixel 8 Obsidian 128 Go', '{"color": "Obsidian", "storage": 128}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (2, 1, 'GGLPX8O256', '0840244706906', 'Pixel 8 Obsidian 256 Go', '{"color": "Obsidian", "storage": 256}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (3, 1, 'GGLPX8H128', '0840244706807', 'Pixel 8 Hazel 128 Go', '{"color": "Hazel", "storage": 128}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (4, 1, 'GGLPX8H256', '0840244707118', 'Pixel 8 Hazel 256 Go', '{"color": "Hazel", "storage": 256}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (5, 1, 'GGLPX8R128', '0840244706982', 'Pixel 8 Rose 128 Go', '{"color": "Rose", "storage": 128}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (6, 1, 'GGLPX8R256', '0840244707231', 'Pixel 8 Rose 256 Go', '{"color": "Rose", "storage": 256}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (7, 1, 'GGLPX8M128', '0840244707071', 'Pixel 8 Mint 128 Go', '{"color": "Mint", "storage": 128}', 150.5, 70.8, 8.9, 187); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (2, 'pixel-8-pro', 'Pixel 8 Pro', 1, 'Phones', 'Smartphones', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (8, 2, 'GGLPX8PO128', '0840244705046', 'Pixel 8 Pro Obsidian 128 Go', '{"color": "Obsidian", "storage": 128}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (9, 2, 'GGLPX8PO256', '0840244705299', 'Pixel 8 Pro Obsidian 256 Go', '{"color": "Obsidian", "storage": 256}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (10, 2, 'GGLPX8PO512', '0840244705565', 'Pixel 8 Pro Obsidian 512 Go', '{"color": "Obsidian", "storage": 512}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (11, 2, 'GGLPX8PB128', '0840244705206', 'Pixel 8 Pro Bay 128 Go', '{"color": "Bay", "storage": 128}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (12, 2, 'GGLPX8PB256', '0840244705473', 'Pixel 8 Pro Bay 256 Go', '{"color": "Bay", "storage": 256}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (13, 2, 'GGLPX8PP128', '0840244705121', 'Pixel 8 Pro Porcelain 128 Go', '{"color": "Porcelain", "storage": 128}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (14, 2, 'GGLPX8PP256', '0840244705381', 'Pixel 8 Pro Porcelain 256 Go', '{"color": "Porcelain", "storage": 256}', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (3, 'pixel-8a', 'Pixel 8a', 1, 'Phones', 'Smartphones', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (4, 'pixel-9', 'Pixel 9', 1, 'Phones', 'Smartphones', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (6, 'pixel-9-pro', 'Pixel 9 Pro', 1, 'Phones', 'Smartphones', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (5, 'pixel-9-pro-xl', 'Pixel 9 Pro XL', 1, 'Phones', 'Smartphones', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (7, 'pixel-9-pro-fold', 'Pixel 9 Pro Fold', 1, 'Phones', 'Smartphones', 162.6, 76.5, 8.8, 213); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (8, 'pixel-8-case', 'Pixel 8 Case', 1, 'Phones', 'Accessories', 154.8, 75.1, 13.4, 27.3); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (15, 8, 'GGLPX8CH', '0840244703806', 'Pixel 8 Case Hazel', '{"color": "Hazel"}', 154.8, 75.1, 13.4, 27.3); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (16, 8, 'GGLPX8CC', '0840244703807', 'Pixel 8 Case Coral', '{"color": "Coral"}', 154.8, 75.1, 13.4, 27.3); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (17, 8, 'GGLPX8CM', '0840244703783', 'Pixel 8 Case Mint', '{"color": "Mint"}', 154.8, 75.1, 13.4, 27.3); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (18, 8, 'GGLPX8CR', '0840244703813', 'Pixel 8 Case Rose', '{"color": "Rose"}', 154.8, 75.1, 13.4, 27.3); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (19, 8, 'GGLPX8CCH', '0840244703790', 'Pixel 8 Case Charcoal', '{"color": "Charcoal"}', 154.8, 75.1, 13.4, 27.3); +INSERT INTO C##INVENTORY.PRODUCTS (ID, SLUG, NAME, BRAND, CATEGORY, SUBCATEGORY, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (9, 'pixel-8-casemate-signature', 'Pixel 8 Case Signature', 1, 'Phones', 'Accessories', 155.7, 76.5, 13.7, 1.7); +INSERT INTO C##INVENTORY.PRODUCT_VERSIONS (ID, PRODUCT_ID, SKU, EAN, NAME, SPECS, WIDTH, LENGTH, HEIGHT, WEIGHT) VALUES (20, 9, 'GGLPX8CS', '0840244703900', 'Pixel 8 Case Signature Clear', '{}', 155.7, 76.5, 13.7, 1.7); + +INSERT INTO C##INVENTORY.SUPPLIERS (NAME, "LEVEL", CURRENCY) VALUES ('Google', 1, 'USD'); +INSERT INTO C##INVENTORY.SUPPLIERS (NAME, "LEVEL", CURRENCY) VALUES ('FNAC', 2, 'EUR'); + +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 1, 699); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 2, 759); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 3, 699); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 4, 759); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 5, 699); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 6, 759); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 7, 699); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 8, 999); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 9, 1059); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 10, 1179); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 11, 999); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 12, 1059); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 13, 999); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 14, 1059); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 15, 34.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 16, 34.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 17, 34.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 18, 34.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 19, 34.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (1, 20, 29.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 1, 549); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 2, 609); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 3, 549); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 4, 609); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 5, 549); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 6, 609); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 7, 549); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 8, 749); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 9, 809); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 10, 949); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 11, 749); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 12, 809); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 13, 749); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 14, 809); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 15, 39.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 17, 39.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 18, 39.99); +INSERT INTO C##INVENTORY.SUPPLIER_PRICES (SUPPLIER_ID, PRODUCT_VERSION_ID, PRICE) VALUES (2, 19, 39.99); + +INSERT INTO C##INVENTORY.SUPPLIER_EMPLOYEES (SUPPLIER_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 12, 'sale', 3, 3); +INSERT INTO C##INVENTORY.SUPPLIER_EMPLOYEES (SUPPLIER_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (1, 13, 'delivery', 3, 3); +INSERT INTO C##INVENTORY.SUPPLIER_EMPLOYEES (SUPPLIER_ID, EMPLOYEE_ID, ROLE, CREATED_BY, UPDATED_BY) VALUES (2, 14, 'delivery', 3, 3); + +INSERT INTO C##INVENTORY.PURCHASE_ORDERS (SUPPLIER_ID, PRICE, CURRENCY, DETAILS, NOTES, CREATED_BY, UPDATED_BY) VALUES (1, 9471.92, 'USD', 'Order 1 from Google', 'Make initial stock', 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 3, 699, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 2, 2, 759, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 3, 2, 699, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 5, 2, 699, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 7, 2, 699, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 15, 3, 34.99, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 16, 2, 34.99, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (1, 20, 3, 29.99, 16, 16); + +INSERT INTO C##INVENTORY.PURCHASE_ORDERS (SUPPLIER_ID, PRICE, CURRENCY, DETAILS, NOTES, CREATED_BY, UPDATED_BY) VALUES (2, 7121, 'EUR', 'Order 1 from FNAC', 'Make initial stock', 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 8, 3, 749, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 9, 1, 809, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 10, 1, 949, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 11, 1, 749, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 12, 1, 809, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 13, 1, 749, 16, 16); +INSERT INTO C##INVENTORY.PURCHASE_ORDER_ITEMS (PURCHASE_ORDER_ID, PRODUCT_VERSION_ID, QUANTITY, PRICE, CREATED_BY, UPDATED_BY) VALUES (2, 14, 1, 809, 16, 16); + +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (1, 1, 'F2ST123456', NULL, NULL, NULL); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (2, 1, 'F2ST123457', NULL, NULL, 1); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (3, 1, 'F2ST123458', NULL, NULL, 1); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (4, 2, 'F2ST123459', NULL, NULL, NULL); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (5, 2, 'F2ST123460', NULL, NULL, 2); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (6, 3, 'FK3B789012', NULL, NULL, 2); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (7, 3, 'FK3B789013', NULL, NULL, 2); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (8, 5, 'FK3B789014', NULL, NULL, 3); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (9, 5, 'FK3B789015', NULL, NULL, 3); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (10, 7, 'FK3B789016', NULL, NULL, 3); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (11, 7, 'FG8N456789', NULL, NULL, 3); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (12, 15, 'FG8N456790', NULL, NULL, NULL); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (13, 15, 'FG8N456791', NULL, NULL, 28); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (14, 15, 'FG8N456792', NULL, NULL, 28); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (15, 16, 'FG8N456793', NULL, NULL, 29); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (16, 16, 'FL5H345678', NULL, NULL, 29); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (17, 20, 'FL5H345679', NULL, NULL, NULL); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (18, 20, 'FL5H345680', NULL, NULL, 30); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (19, 20, 'FL5H345681', NULL, NULL, 30); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (20, 8, 'FM7J234567', NULL, NULL, 10); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (21, 8, 'FM7J234568', NULL, NULL, 10); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (22, 8, 'FM7J234569', NULL, NULL, 10); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (23, 9, 'FM7J234570', NULL, NULL, 11); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (24, 10, 'FM7J234571', NULL, NULL, 11); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (25, 11, 'FM7J234572', NULL, NULL, 11); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (26, 12, 'FM7J234573', NULL, NULL, 12); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (27, 13, 'FM7J234574', NULL, NULL, 12); +INSERT INTO C##INVENTORY.PHYSICAL_PRODUCTS (ID, PRODUCT_VERSION_ID, SNID, EXPIRATION, REMARKS, STORED) VALUES (28, 14, 'FM7J234575', NULL, NULL, 12); + +INSERT INTO C##INVENTORY.DELIVERIES (REASON, ACCEPTED, PURCHASE_ORDER_ID, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('supplier_delivery', 'Y', 1, 1, 4, 1, 13, CURRENT_TIMESTAMP); INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 1); -INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 2); - -INSERT INTO C##INVENTORY.PICKUPS (REASON, ACCEPTED, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('customer_delivery', 'Y', 1, 1, 1, 1, CURRENT_TIMESTAMP); -INSERT INTO C##INVENTORY.PICKUPS (REASON, ACCEPTED, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('supplier_return', 'N', 2, 2, 2, 2, CURRENT_TIMESTAMP); - -INSERT INTO C##INVENTORY.PICKUP_ITEMS (PICKUP_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 1); -INSERT INTO C##INVENTORY.PICKUP_ITEMS (PICKUP_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 2); - -INSERT INTO C##INVENTORY.INVENTORIES (NAME, WAREHOUSE_ID, PLANNED, CREATED_BY, UPDATED_BY) VALUES ('Inventory 1', 1, TO_TIMESTAMP('2022-01-01 10:00:00', 'YYYY-MM-DD HH24:MI:SS'), 1, 1); -INSERT INTO C##INVENTORY.INVENTORIES (NAME, WAREHOUSE_ID, PLANNED, CREATED_BY, UPDATED_BY) VALUES ('Inventory 2', 2, TO_TIMESTAMP('2022-01-02 10:00:00', 'YYYY-MM-DD HH24:MI:SS'), 1, 1); - +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 2); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 3); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 4); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 5); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 6); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 7); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 8); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 9); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 10); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 11); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 12); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 13); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 14); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 15); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 16); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 17); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 18); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 19); + +INSERT INTO C##INVENTORY.DELIVERIES (REASON, ACCEPTED, PURCHASE_ORDER_ID, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('supplier_delivery', 'Y', 2, 1, 4, 2, 14, CURRENT_TIMESTAMP); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 20); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 21); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 22); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 23); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 24); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 25); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 26); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 27); +INSERT INTO C##INVENTORY.DELIVERY_ITEMS (DELIVERY_ID, PHYSICAL_PRODUCT_ID) VALUES (2, 28); + +INSERT INTO C##INVENTORY.DELIVERIES (REASON, ACCEPTED, PURCHASE_ORDER_ID, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('customer_return', 'N', NULL, 1, 5, NULL, NULL, CURRENT_TIMESTAMP); + +INSERT INTO C##INVENTORY.INVENTORIES (NAME, WAREHOUSE_ID, PLANNED, CREATED_BY, UPDATED_BY) VALUES ('Initial inventory', 1, TO_TIMESTAMP('2022-01-01 10:00:00', 'YYYY-MM-DD HH24:MI:SS'), 16, 16); INSERT INTO C##INVENTORY.INVENTORY_MEMBERS (INVENTORY_ID, WAREHOUSE_ID, EMPLOYEE_ID) VALUES (1, 1, 1); -INSERT INTO C##INVENTORY.INVENTORY_MEMBERS (INVENTORY_ID, WAREHOUSE_ID, EMPLOYEE_ID) VALUES (2, 2, 2); +INSERT INTO C##INVENTORY.INVENTORY_MEMBERS (INVENTORY_ID, WAREHOUSE_ID, EMPLOYEE_ID) VALUES (1, 1, 2); +INSERT INTO C##INVENTORY.INVENTORY_MEMBERS (INVENTORY_ID, WAREHOUSE_ID, EMPLOYEE_ID) VALUES (1, 1, 3); +INSERT INTO C##INVENTORY.INVENTORY_OBSERVATIONS (INVENTORY_ID, PHYSICAL_PRODUCT_ID, STATUS, MESSAGE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 'missing', 'Item not found', 13, 13); +INSERT INTO C##INVENTORY.INVENTORY_OBSERVATIONS (INVENTORY_ID, PHYSICAL_PRODUCT_ID, STATUS, MESSAGE, CREATED_BY, UPDATED_BY) VALUES (1, 2, 'broken', 'Item damaged', 14, 14); +INSERT INTO C##INVENTORY.INVENTORY_OBSERVATIONS (INVENTORY_ID, PHYSICAL_PRODUCT_ID, STATUS, MESSAGE, CREATED_BY, UPDATED_BY) VALUES (1, 3, 'misplaced', 'Moved at the right place', 14, 14); -INSERT INTO C##INVENTORY.INVENTORY_OBSERVATIONS (INVENTORY_ID, PHYSICAL_PRODUCT_ID, STATUS, MESSAGE, CREATED_BY, UPDATED_BY) VALUES (1, 1, 'missing', 'Item not found', 1, 1); -INSERT INTO C##INVENTORY.INVENTORY_OBSERVATIONS (INVENTORY_ID, PHYSICAL_PRODUCT_ID, STATUS, MESSAGE, CREATED_BY, UPDATED_BY) VALUES (2, 2, 'broken', 'Item damaged', 1, 1); +INSERT INTO C##INVENTORY.PICKUPS (REASON, ACCEPTED, WAREHOUSE_ID, WAREHOUSE_EMPLOYEE_ID, SUPPLIER_ID, SUPPLIER_EMPLOYEE_ID, DELIVERED_AT) VALUES ('customer_delivery', 'Y', 1, 2, NULL, NULL, CURRENT_TIMESTAMP); +INSERT INTO C##INVENTORY.PICKUP_ITEMS (PICKUP_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 1); +INSERT INTO C##INVENTORY.PICKUP_ITEMS (PICKUP_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 4); +INSERT INTO C##INVENTORY.PICKUP_ITEMS (PICKUP_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 12); +INSERT INTO C##INVENTORY.PICKUP_ITEMS (PICKUP_ID, PHYSICAL_PRODUCT_ID) VALUES (1, 17); diff --git a/demos/ecommerce/source_04_catalog_postgres.sql b/demos/ecommerce/source_04_catalog_postgres.sql index 7101a1686..589b58f12 100644 --- a/demos/ecommerce/source_04_catalog_postgres.sql +++ b/demos/ecommerce/source_04_catalog_postgres.sql @@ -167,48 +167,147 @@ CREATE INDEX idx_product_review_feedbacks_deleted_at ON catalog.product_review_f -- insert some data INSERT INTO catalog.categories (id, parent, depth, slug, name, description, description_html) VALUES (1, NULL, 0, 'electronics', 'Electronics', 'All electronic items', '
All electronic items
'), - (2, 1, 1, 'phones', 'Phones', 'All kinds of phones', 'All kinds of phones
'); + (2, 1, 1, 'phones', 'Phones', 'All kinds of phones', 'All kinds of phones
'), + (3, 2, 2, 'smartphones', 'SmartPhones', 'Most advanced phones', 'Most advanced phones
'), + (4, 1, 1, 'accessories', 'Accessories', 'Useful accessories', 'Useful accessories
'); INSERT INTO catalog.products (id, slug, name, category_id, description, description_html, versions, attributes, stock) -VALUES (1, 'pixel-8-pro', 'Pixel 8 Pro', 2, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[{"key": "color", "label": "Couleur", "values": [{"name": "Bleu Azur", "value": "#95bbe2"}]}, {"key": "storage", "label": "Taille", "values": [{"name": "128GB", "value": 128}]}]', '[{"key": "Marque", "value": "Google"}]', 100), - (2, 'iphone-14', 'iPhone 14', 2, 'The latest iPhone by Apple', 'The latest iPhone by Apple
', '[{"key": "color", "label": "Couleur", "values": [{"name": "Noir", "value": "#000000"}]}, {"key": "storage", "label": "Taille", "values": [{"name": "256GB", "value": 256}]}]', '[{"key": "Marque", "value": "Apple"}]', 50); +VALUES (1, 'pixel-8', 'Pixel 8', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[{"key": "color", "label": "Color", "values": [{"name": "Obsidian", "value": "#202020"}, {"name": "Hazel", "value": "#8B8D8B"}, {"name": "Rose", "value": "#F1DDD2"}, {"name": "Mint", "value": "#DDF2E5"}]}, {"key": "storage", "label": "Storage", "values": [{"name": "128 GB", "value": 128}, {"name": "256 GB", "value": 256}]}]', '[{"key": "Brand", "value": "Google"}, {"key": "Screen size", "value": "6,2\""}, {"key": "RAM", "value": "8 Go"}, {"key": "Weight", "value": "187 g"}]', 11), + (2, 'pixel-8-pro', 'Pixel 8 Pro', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[]', '[]', 9), + (3, 'pixel-8a', 'Pixel 8a', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[]', '[]', 0), + (4, 'pixel-9', 'Pixel 9', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[]', '[]', 0), + (5, 'pixel-9-pro', 'Pixel 9 Pro', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[]', '[]', 0), + (6, 'pixel-9-pro-xl', 'Pixel 9 Pro XL', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[]', '[]', 0), + (7, 'pixel-9-pro-fold', 'Pixel 9 Pro Fold', 3, 'A high-end smartphone by Google', 'A high-end smartphone by Google
','[]', '[]', 0), + (8, 'pixel-8-case', 'Pixel 8 Case', 4, 'Protect your phone with class!', 'Protect your phone with class!
','[]', '[]', 5), + (9, 'pixel-8-casemate-signature', 'Pixel 8 Case Signature', 4, 'Protect your phone with class!', 'Protect your phone with class!
','[]', '[]', 3); INSERT INTO catalog.product_versions (id, product_id, name, specs, price, stock) -VALUES (1, 1, 'Pixel 8 Pro Menthe 128 Go', '{"color": "Menthe", "storage": 128}', 899.99, 50), - (2, 2, 'iPhone 14 Noir 256 Go', '{"color": "Noir", "storage": 256}', 1099.99, 25); +VALUES (1, 1, 'Pixel 8 Obsidian 128 Go', '{"color": "Obsidian", "storage": 128}', 599, 2), + (2, 1, 'Pixel 8 Obsidian 256 Go', '{"color": "Obsidian", "storage": 256}', 659, 1), + (3, 1, 'Pixel 8 Hazel 128 Go', '{"color": "Hazel", "storage": 128}', 599, 2), + (4, 1, 'Pixel 8 Hazel 256 Go', '{"color": "Hazel", "storage": 256}', 659, 0), + (5, 1, 'Pixel 8 Rose 128 Go', '{"color": "Rose", "storage": 128}', 599, 2), + (6, 1, 'Pixel 8 Rose 256 Go', '{"color": "Rose", "storage": 256}', 659, 0), + (7, 1, 'Pixel 8 Mint 128 Go', '{"color": "Mint", "storage": 128}', 599, 2), + (8, 2, 'Pixel 8 Pro Obsidian 128 Go', '{"color": "Obsidian", "storage": 128}', 899, 3), + (9, 2, 'Pixel 8 Pro Obsidian 256 Go', '{"color": "Obsidian", "storage": 256}', 959, 1), + (10, 2, 'Pixel 8 Pro Obsidian 512 Go', '{"color": "Obsidian", "storage": 512}', 1099, 1), + (11, 2, 'Pixel 8 Pro Bay 128 Go', '{"color": "Bay", "storage": 128}', 899, 1), + (12, 2, 'Pixel 8 Pro Bay 256 Go', '{"color": "Bay", "storage": 256}', 959, 1), + (13, 2, 'Pixel 8 Pro Porcelain 128 Go', '{"color": "Porcelain", "storage": 128}', 899, 1), + (14, 2, 'Pixel 8 Pro Porcelain 256 Go', '{"color": "Porcelain", "storage": 256}', 959, 1), + (15, 8, 'Pixel 8 Case Hazel', '{"color": "Hazel"}', 35, 2), + (16, 8, 'Pixel 8 Case Coral', '{"color": "Coral"}', 35, 2), + (17, 8, 'Pixel 8 Case Mint', '{"color": "Mint"}', 35, 0), + (18, 8, 'Pixel 8 Case Rose', '{"color": "Rose"}', 35, 0), + (19, 8, 'Pixel 8 Case Charcoal', '{"color": "Charcoal"}', 35, 0), + (20, 9, 'Pixel 8 Case Signature Clear', '{}', 30, 2); INSERT INTO catalog.product_cross_sell_options (product_id, product_version_id, label) -VALUES (1, 2, 'Buy with iPhone 14 case'), - (2, 1, 'Buy with Pixel 8 Pro case'); +VALUES (1, 15, 'Protect your phone'), + (1, 20, 'Protect your phone'); INSERT INTO catalog.product_alternatives (product_id, alternative_product_id) VALUES (1, 2), - (2, 1); + (1, 3), + (1, 4), + (2, 1), + (2, 3), + (2, 4), + (3, 1), + (3, 2), + (3, 4), + (4, 1), + (4, 5), + (4, 6), + (4, 7), + (5, 1), + (5, 4), + (5, 6), + (5, 7), + (6, 1), + (6, 4), + (6, 5), + (6, 7), + (7, 1), + (7, 4), + (7, 5), + (7, 6); INSERT INTO catalog.assets (id, kind, format, size, path, alt, width, height, weight) -VALUES (1, 'picture', '1:1', 'high', '/images/pixel-8-pro.png', 'Pixel 8 Pro Image', 1024, 1024, 500), - (2, 'picture', '1:1', 'high', '/images/iphone-14.png', 'iPhone 14 Image', 1024, 1024, 500); +VALUES (1, 'picture', '16:9', 'high', '/images/categories/electronics/banner.png', 'Electronics banner', 1600, 900, 500), + (2, 'picture', '16:9', 'high', '/images/categories/electronics/phones/banner.png', 'Phones banner', 1600, 900, 500), + (3, 'picture', '16:9', 'high', '/images/categories/electronics/phones/smartphones/banner.png', 'SmartPhones banner', 1600, 900, 500), + (4, 'picture', '16:9', 'high', '/images/categories/electronics/accessories/banner.png', 'Accessories banner', 1600, 900, 500), + (5, 'picture', '1:1', 'high', '/images/categories/electronics/icon.png', 'Electronics icon', 150, 150, 345), + (6, 'picture', '3:4', 'high', '/images/products/pixel-8/obsidian/shot.png', 'Pixel 8 Obsidian shot', 360, 480, 474), + (7, 'picture', '3:4', 'high', '/images/products/pixel-8/hazel/shot.png', 'Pixel 8 Hazel shot', 360, 480, 474), + (8, 'picture', '3:4', 'high', '/images/products/pixel-8/rose/shot.png', 'Pixel 8 Rose shot', 360, 480, 474), + (9, 'picture', '3:4', 'high', '/images/products/pixel-8/mint/shot.png', 'Pixel 8 Mint shot', 360, 480, 474), + (10, 'picture', '3:4', 'high', '/images/products/pixel-8-pro/obsidian/shot.png', 'Pixel 8 Pro Obsidian shot', 360, 480, 474), + (11, 'picture', '3:4', 'high', '/images/products/pixel-8-pro/bay/shot.png', 'Pixel 8 Pro Bay shot', 360, 480, 474), + (12, 'picture', '3:4', 'high', '/images/products/pixel-8-pro/porcelain/shot.png', 'Pixel 8 Pro Porcelain shot', 360, 480, 474), + (13, 'picture', '3:4', 'high', '/images/products/pixel-8a/shot.png', 'Pixel 8a shot', 360, 480, 474), + (14, 'picture', '3:4', 'high', '/images/products/pixel-9/shot.png', 'Pixel 9 shot', 360, 480, 474), + (15, 'picture', '3:4', 'high', '/images/products/pixel-9-pro/shot.png', 'Pixel 9 Pro shot', 360, 480, 474), + (16, 'picture', '3:4', 'high', '/images/products/pixel-9-pro-xl/shot.png', 'Pixel 9 Pro XL shot', 360, 480, 474), + (17, 'picture', '3:4', 'high', '/images/products/pixel-9-pro-fold/shot.png', 'Pixel 9 Pro Fold shot', 360, 480, 474), + (18, 'picture', '3:4', 'high', '/images/products/pixel-8-case/hazel/shot.png', 'Pixel 8 Case Hazel shot', 360, 480, 474), + (19, 'picture', '3:4', 'high', '/images/products/pixel-8-case/coral/shot.png', 'Pixel 8 Case Coral shot', 360, 480, 474), + (20, 'picture', '3:4', 'high', '/images/products/pixel-8-case/mint/shot.png', 'Pixel 8 Case Mint shot', 360, 480, 474), + (21, 'picture', '3:4', 'high', '/images/products/pixel-8-case/rose/shot.png', 'Pixel 8 Case Rose shot', 360, 480, 474), + (22, 'picture', '3:4', 'high', '/images/products/pixel-8-case/charcoal/shot.png', 'Pixel 8 Case Charcoal shot', 360, 480, 474), + (23, 'picture', '3:4', 'high', '/images/products/pixel-8-casemate-signature/shot.png', 'Pixel 8 Case Signature shot', 360, 480, 474), + (24, 'picture', '16:9', 'high', '/uploads/users/102/2024-08-24/9ab74d.jpg', 'User upload', 1280, 720, 12845); INSERT INTO catalog.category_assets (category_id, asset_id, placement) VALUES (1, 1, 'banner'), - (2, 2, 'icon'); + (2, 2, 'banner'), + (3, 3, 'banner'), + (4, 4, 'banner'), + (1, 5, 'icon'); INSERT INTO catalog.product_assets (product_id, asset_id, placement) -VALUES (1, 1, 'banner'), - (2, 2, 'icon'); +VALUES (1, 6, 'main'), + (2, 10, 'main'), + (3, 13, 'main'), + (4, 14, 'main'), + (5, 15, 'main'), + (6, 16, 'main'), + (7, 17, 'main'), + (8, 18, 'main'), + (9, 23, 'main'); INSERT INTO catalog.product_version_assets (product_version_id, asset_id, placement) -VALUES (1, 1, 'banner'), - (2, 2, 'icon'); +VALUES (1, 6, 'main'), + (2, 6, 'main'), + (3, 7, 'main'), + (4, 7, 'main'), + (5, 8, 'main'), + (6, 8, 'main'), + (7, 9, 'main'), + (8, 10, 'main'), + (9, 10, 'main'), + (10, 10, 'main'), + (11, 11, 'main'), + (12, 11, 'main'), + (13, 12, 'main'), + (14, 12, 'main'), + (15, 18, 'main'), + (16, 19, 'main'), + (17, 20, 'main'), + (18, 21, 'main'), + (19, 22, 'main'), + (20, 23, 'main'); -INSERT INTO catalog.product_reviews (id, product_id, product_version_id, rating, review, created_by, updated_by) -VALUES (1, 1, 1, 5, 'Amazing phone!', 1, 1), - (2, 2, 2, 4, 'Great, but too expensive.', 2, 2); +INSERT INTO catalog.product_reviews (id, product_id, product_version_id, invoice_id, physical_product_id, rating, review, created_by, updated_by) +VALUES (1, 1, 1, 1, 1, 5, 'Amazing phone!', 102, 102), + (2, 2, 2, 1, 4, 4, 'Great, but too expensive.', 103, 103); INSERT INTO catalog.product_review_assets (product_review_id, asset_id, created_by) -VALUES (1, 1, 1), - (2, 2, 2); +VALUES (1, 24, 102); INSERT INTO catalog.product_review_feedbacks (product_review_id, kind, created_by) -VALUES (1, 'like', 1), - (2, 'report', 2); +VALUES (1, 'like', 104), + (2, 'report', 105); diff --git a/demos/ecommerce/source_05_shopping_postgres.sql b/demos/ecommerce/source_05_shopping_postgres.sql index 61d263377..24ab6c016 100644 --- a/demos/ecommerce/source_05_shopping_postgres.sql +++ b/demos/ecommerce/source_05_shopping_postgres.sql @@ -76,21 +76,24 @@ CREATE INDEX idx_wishlist_members_deleted_at ON shopping.wishlist_members (delet -- insert some data INSERT INTO shopping.carts (id, owner_kind, owner_id, expire_at) -VALUES (1, 'identity.Users', 1, CURRENT_TIMESTAMP + INTERVAL '1 day'), - (2, 'identity.Devices', 1, CURRENT_TIMESTAMP + INTERVAL '1 day'); +VALUES (1, 'Users', 102, CURRENT_TIMESTAMP + INTERVAL '1 day'), + (2, 'Devices', 1, CURRENT_TIMESTAMP + INTERVAL '1 day'); INSERT INTO shopping.cart_items (cart_id, product_version_id, quantity, price, created_by, updated_by) -VALUES (1, 1, 2, 899.99, 1, 1), - (2, 2, 1, 1099.99, 2, 2); +VALUES (1, 1, 1, 599, 102, 102), + (1, 2, 1, 659, 102, 102), + (1, 15, 1, 35, 102, 102), + (1, 20, 1, 30, 102, 102), + (2, 7, 2, 599, NULL, NULL); INSERT INTO shopping.wishlists (id, name, description, public, created_by, updated_by) -VALUES (1, 'John''s Wishlist', 'John''s favorite products', TRUE, 1, 1), - (2, 'Jane''s Wishlist', 'Jane''s favorite products', FALSE, 2, 2); +VALUES (1, 'Bob''s Wishlist', 'Bob''s favorite products', TRUE, 102, 102); INSERT INTO shopping.wishlist_items (wishlist_id, product_id, specs, created_by) -VALUES (1, 1, '{"color": "Menthe", "storage": 128}', 1), - (2, 2, '{"color": "Noir", "storage": 256}', 2); +VALUES (1, 1, '{"color": "Obsidian", "storage": 128}', 102), + (1, 2, '{"color": "Obsidian", "storage": 256}', 102), + (1, 8, '{"color": "Coral"}', 102); INSERT INTO shopping.wishlist_members (wishlist_id, user_id, rights, created_by, updated_by) -VALUES (1, 1, 'edit', 1, 1), - (2, 2, 'view', 2, 2); +VALUES (1, 102, 'edit', 102, 102), + (1, 103, 'view', 102, 102); diff --git a/demos/ecommerce/source_06_billing_sqlserver.sql b/demos/ecommerce/source_06_billing_sqlserver.sql index 8721959c5..4e2b523ed 100644 --- a/demos/ecommerce/source_06_billing_sqlserver.sql +++ b/demos/ecommerce/source_06_billing_sqlserver.sql @@ -105,32 +105,30 @@ CREATE TABLE [billing].[Payments] ( -- insert some data -INSERT INTO [billing].[CustomerAddresses] ([Name], [Street], [City], [State], [ZipCode], [Country], [CreatedBy]) -VALUES ('Billing Address 1', '123 Main St', 'Anytown', 'Anystate', '12345', 1, 1), - ('Billing Address 2', '456 Elm St', 'Othertown', 'Otherstate', '67890', 2, 2); +INSERT INTO [billing].[CustomerAddresses] ([Name], [Street], [City], [State], [ZipCode], [Country], [Complements], [CreatedBy]) +VALUES ('SpongeHome', '124 Conch Street', 'Bikini Bottom', 'Pacific Ocean', '12345', 1, 'Pineapple house next to Squidward', 102); INSERT INTO [billing].[Customers] ([Name], [BillingAddress], [Siret], [TVA], [CreatedBy], [UpdatedBy]) -VALUES ('Customer A', NULL, '12345678901234', 'FR12345678901', 1, 1), - ('Customer B', NULL, '98765432109876', 'DE09876543210', 2, 2); +VALUES ('SpongeBob', 1, NULL, NULL, 102, 102), + ('Krusty Enterprises', 1, '12345678900010', 'FR12345678901', 102, 102); -INSERT INTO [billing].[CustomerMembers] ([CustomerId], [UserId], [CanEdit], [CanInvite], [CanBuy], [BudgetAllowance], - [CreatedBy], [UpdatedBy]) -VALUES (1, 1, 1, 1, 1, 1000, 1, 1), - (2, 2, 1, 0, 1, 500, 2, 2); +INSERT INTO [billing].[CustomerMembers] ([CustomerId], [UserId], [CanEdit], [CanInvite], [CanBuy], [BudgetAllowance], [CreatedBy], [UpdatedBy]) +VALUES (1, 102, 1, 1, 1, NULL, 102, 102), + (2, 102, 1, 1, 1, NULL, 102, 102), + (2, 103, 1, 0, 1, 500, 102, 102); INSERT INTO [billing].[CustomerPaymentMethods] ([CustomerId], [Name], [Kind], [Details], [CreatedBy], [UpdatedBy]) -VALUES (1, 'Credit Card', 'card', '{"card_number": "4111111111111111", "expiry_date": "12/23"}', 1, 1), - (2, 'PayPal', 'paypal', '{"paypal_account": "customer_b@paypal.com"}', 2, 2); +VALUES (1, 'PayPal perso', 'paypal', '{"paypal_account": "spongebob@bikinibottom.com"}', 102, 102), + (2, 'Company Card', 'card', '{"card_number": "4111111111111111", "expiry_date": "12/28"}', 102, 102); -INSERT INTO [billing].[Invoices] ([Reference], [CartId], [CustomerId], [BillingAddress], [TotalPrice], [Currency], - [CreatedBy]) -VALUES ('INV-001', 1, 1, 1, 200.00, 'USD', 1), - ('INV-002', 2, 2, 2, 300.00, 'EUR', 2); +INSERT INTO [billing].[Invoices] ([Reference], [CartId], [CustomerId], [BillingAddress], [TotalPrice], [Currency], [CreatedBy]) +VALUES ('INV-001', 1, 1, 1, 1323, 'EUR', 102); INSERT INTO [billing].[InvoiceLines] ([InvoiceId], [Index], [ProductVersionId], [Description], [Price], [Quantity]) -VALUES (1, 1, 1, 'Product 1 Description', 100.00, 2), - (2, 1, 2, 'Product 2 Description', 150.00, 2); +VALUES (1, 1, 1, 'Pixel 8 Obsidian 128 Go', 599, 1), + (1, 2, 2, 'Pixel 8 Obsidian 256 Go', 659, 1), + (1, 3, 15, 'Pixel 8 Case Hazel', 35, 1), + (1, 4, 20, 'Pixel 8 Case Signature Clear', 30, 1); INSERT INTO [billing].[Payments] ([InvoiceId], [PaymentMethodId], [Amount], [Currency]) -VALUES (1, 1, 200.00, 'USD'), - (2, 2, 300.00, 'EUR'); +VALUES (1, 1, 1323, 'EUR'); diff --git a/demos/ecommerce/source_07_shipping_mongo.sql b/demos/ecommerce/source_07_shipping_mongo.sql index d86cafe3b..5c1f9e204 100644 --- a/demos/ecommerce/source_07_shipping_mongo.sql +++ b/demos/ecommerce/source_07_shipping_mongo.sql @@ -1,9 +1,9 @@ use shipping; // drop everything -db.Carriers.drop(); -db.Shipments.drop(); db.ShipmentItems.drop(); +db.Shipments.drop(); +db.Carriers.drop(); // create the collections @@ -11,14 +11,15 @@ db.createCollection('Carriers', { validator: { $jsonSchema: { bsonType: "object", - required: ["id", "registration", "cargoWidth", "cargoLength", "cargoHeight", "cargoWeight", "createdAt", "updatedAt"], + required: ["id", "registration", "licensePlate", "cargoWidth", "cargoLength", "cargoHeight", "cargoWeight", "createdAt", "updatedAt"], properties: { id: { bsonType: "number" }, registration: { bsonType: "string" }, - cargoWidth: { bsonType: "number" }, - cargoLength: { bsonType: "number" }, - cargoHeight: { bsonType: "number" }, - cargoWeight: { bsonType: "number" }, + licensePlate: { bsonType: "string" }, + cargoWidth: { bsonType: "number", description: "inner cargo width in millimeters" }, + cargoLength: { bsonType: "number", description: "inner cargo length in millimeters" }, + cargoHeight: { bsonType: "number", description: "inner cargo height in millimeters" }, + cargoWeight: { bsonType: "number", description: "maximum weight for the cargo, in kilograms" }, createdAt: { bsonType: "date" }, createdBy: { bsonType: "number" }, updatedAt: { bsonType: "date" }, @@ -63,7 +64,7 @@ db.createCollection('ShipmentItems', { invoiceId: { bsonType: "number" }, invoiceLine: { bsonType: "int" }, deliveredAt: { bsonType: "date" }, - deliveredTo: { bsonType: "number" } + deliveredTo: { bsonType: "number", description: "the User who got the delivered package" } } } } @@ -72,74 +73,19 @@ db.createCollection('ShipmentItems', { // insert some data db.Carriers.insertMany([ - { - id: 1, - registration: "ABC123", - cargoWidth: 2.5, - cargoLength: 10.0, - cargoHeight: 3.0, - cargoWeight: 2000.0, - createdAt: new Date(), - createdBy: 1, - updatedAt: new Date(), - }, - { - id: 2, - registration: "XYZ789", - cargoWidth: 2.0, - cargoLength: 8.0, - cargoHeight: 2.5, - cargoWeight: 1500.0, - createdAt: new Date(), - createdBy: 2, - updatedAt: new Date(), - } + {_id: ObjectId("66cb179dfdd0405e567c1938"), id: 1, registration: "KR123456789", licensePlate: "KR-PLATE-001", cargoWidth: 2500, cargoLength: 12000, cargoHeight: 3000, cargoWeight: 24000, createdAt: new Date(), createdBy: 24, updatedAt: new Date(), updatedBy: 24}, + {_id: ObjectId("66cb179dfdd0405e567c1939"), id: 2, registration: "KR987654321", licensePlate: "KR-PLATE-002", cargoWidth: 2600, cargoLength: 13000, cargoHeight: 3200, cargoWeight: 25000, createdAt: new Date(), createdBy: 24, updatedAt: new Date(), updatedBy: 24}, + {_id: ObjectId("66cb179dfdd0405e567c193a"), id: 3, registration: "KR112233445", licensePlate: "KR-PLATE-003", cargoWidth: 2400, cargoLength: 11500, cargoHeight: 2900, cargoWeight: 23000, createdAt: new Date(), createdBy: 24, updatedAt: new Date(), updatedBy: 24}, + {_id: ObjectId("66cb179dfdd0405e567c193b"), id: 4, registration: "KR556677889", licensePlate: "KR-PLATE-004", cargoWidth: 2550, cargoLength: 12500, cargoHeight: 3100, cargoWeight: 24500, createdAt: new Date(), createdBy: 24, updatedAt: new Date(), updatedBy: 24}, ]); db.Shipments.insertMany([ - { - id: 1, - carrierId: 1, - createdAt: new Date(), - collectedAt: new Date(), - collectedBy: 1, - packagedAt: new Date(), - packagedBy: 1, - loadedAt: new Date(), - loadedBy: 1, - deliveredAt: new Date(), - deliveredBy: 1 - }, - { - id: 2, - carrierId: 2, - createdAt: new Date(), - collectedAt: new Date(), - collectedBy: 2, - packagedAt: new Date(), - packagedBy: 2, - loadedAt: new Date(), - loadedBy: 2, - deliveredAt: new Date(), - deliveredBy: 2 - } + {_id: ObjectId("66cb17a0fdd0405e567c193d"), id: 1, carrierId: 1, createdAt: new Date(), collectedAt: new Date(), collectedBy: 14, packagedAt: new Date(), packagedBy: 14, loadedAt: new Date(), loadedBy: 24, deliveredAt: new Date(), deliveredBy: 24}, ]); db.ShipmentItems.insertMany([ - { - shipmentId: 1, - physicalProductId: 1, - invoiceId: 1, - invoiceLine: 1, - deliveredAt: new Date(), - deliveredTo: 1 - }, - { - shipmentId: 2, - physicalProductId: 2, - invoiceId: 2, - invoiceLine: 1, - deliveredAt: new Date(), - deliveredTo: 2 - } + {_id: ObjectId("66cb17a3fdd0405e567c193f"), shipmentId: 1, physicalProductId: 1, invoiceId: 1, invoiceLine: 1, deliveredAt: new Date(), deliveredTo: 102}, + {_id: ObjectId("66cb17a3fdd0405e567c1940"), shipmentId: 1, physicalProductId: 4, invoiceId: 1, invoiceLine: 2, deliveredAt: new Date(), deliveredTo: 102}, + {_id: ObjectId("66cb17a3fdd0405e567c1941"), shipmentId: 1, physicalProductId: 12, invoiceId: 1, invoiceLine: 3, deliveredAt: new Date(), deliveredTo: 102}, + {_id: ObjectId("66cb17a3fdd0405e567c1942"), shipmentId: 1, physicalProductId: 17, invoiceId: 1, invoiceLine: 4, deliveredAt: new Date(), deliveredTo: 102}, ]); diff --git a/demos/ecommerce/source_09_analytics_mongo.sql b/demos/ecommerce/source_09_analytics_mongo.sql index c764471cb..1682b37ad 100644 --- a/demos/ecommerce/source_09_analytics_mongo.sql +++ b/demos/ecommerce/source_09_analytics_mongo.sql @@ -57,51 +57,12 @@ db.createCollection('Entities', { // insert some data db.Events.insertMany([ - { - id: UUID(), - name: "user__login__success", - source: "website", - details: { ip: "192.168.1.1", browser: "Chrome" }, - entities: { user: [{ id: "1", name: "Loïc Knuchel", email: "loic@azimutt.app" }] }, - createdAt: new Date() - }, - { - id: UUID(), - name: "order__purchase__completed", - source: "app", - details: { amount: 200 }, - entities: { - user: [{ id: "1", name: "Loïc Knuchel" }], - cart: [{ id: "1", name: "Cart 1", items: 2 }], - invoice: [{ id: "1", name: "INV-001", price: 200, currency: "USD", lines: 1 }], - }, - createdAt: new Date() - } + {_id: ObjectId("66c19109ab46f11e824ed6a9"), id: "af099435-b2ed-4871-8f27-8bc88e15b68c", name: "user__login__success", source: "website", details: { ip: "192.168.1.1", browser: "Chrome" }, entities: { user: [{ id: "1", name: "Loïc Knuchel", email: "loic@azimutt.app" }] }, createdAt: new Date()}, + {_id: ObjectId("66c19109ab46f11e824ed6aa"), id: "f35afcfa-92e4-491e-9e51-ed8ac51a9e20", name: "order__purchase__completed", source: "app", details: { amount: 200 }, entities: {user: [{id: "1", name: "Loïc Knuchel"}], cart: [{id: "1", name: "Cart 1", items: 2}], invoice: [{id: "1", name: "INV-001", price: 200, currency: "USD", lines: 1}]}, createdAt: new Date()}, ]); db.Entities.insertMany([ - { - kind: "user", - id: "1", - name: "Loïc Knuchel", - properties: { email: "loic@azimutt.app" }, - createdAt: new Date(), - updatedAt: new Date() - }, - { - kind: "cart", - id: "1", - name: "Cart 1", - properties: { items: 2 }, - createdAt: new Date(), - updatedAt: new Date() - }, - { - kind: "invoice", - id: "1", - name: "INV-001", - properties: { price: 200, currency: "USD", lines: 1 }, - createdAt: new Date(), - updatedAt: new Date() - } + {kind: "user", id: "1", name: "Loïc Knuchel", properties: { email: "loic@azimutt.app" }, createdAt: new Date(), updatedAt: new Date()}, + {kind: "cart", id: "1", name: "Cart 1", properties: { items: 2 }, createdAt: new Date(), updatedAt: new Date()}, + {kind: "invoice", id: "1", name: "INV-001", properties: { price: 200, currency: "USD", lines: 1 }, createdAt: new Date(), updatedAt: new Date()}, ]); diff --git a/frontend/src/Components/Organisms/TableRow.elm b/frontend/src/Components/Organisms/TableRow.elm index 924984f2c..23be39184 100644 --- a/frontend/src/Components/Organisms/TableRow.elm +++ b/frontend/src/Components/Organisms/TableRow.elm @@ -811,7 +811,7 @@ viewFooter now source row = StateSuccess s -> s.loadedAt in - div [ class "px-3 py-1 bg-default-50 text-right italic border-t border-gray-200" ] + div [ class "px-3 py-1 bg-default-50 text-right italic border-t border-gray-200 truncate" ] [ text "from " , source |> Maybe.mapOrElse (\s -> text s.name) (span [ title (SourceId.toString row.source) ] [ text "unknown source" ]) , text ", "