Files
simply_cpq/buildtime/database/init.sql
T
2026-08-22 18:28:46 +02:00

72 lines
1.6 KiB
SQL

-- 1. Globale Sequence anlegen
CREATE SEQUENCE global_id_seq
START 1000000
INCREMENT 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
-- 2. Value Table
-- Value Table
CREATE TABLE IF NOT EXISTS values (
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
description TEXT,
propertyId BIGINT
);
-- Property Table
CREATE TABLE IF NOT EXISTS properties (
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
description TEXT,
propertyTypeId BIGINT,
productId BIGINT,
productGroupId BIGINT
);
-- PropertyType Table
CREATE TABLE IF NOT EXISTS propertyTypes(
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
description TEXT,
propertyTypeGroupId BIGINT
);
-- PropertyTypeGroupTable
CREATE TABLE IF NOT EXISTS propertyTypeGroups (
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
description TEXT,
parentGroupId BIGINT
);
-- 3. Product Tables
-- Product Table
CREATE TABLE IF NOT EXISTS products (
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
externalId TEXT,
description TEXT,
productGroupId BIGINT
);
-- ProductGroup Table
CREATE TABLE IF NOT EXISTS productGroups (
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
description TEXT,
parentGroupId BIGINT
);
-- Media Table
CREATE TABLE IF NOT EXISTS media (
id BIGINT PRIMARY KEY DEFAULT nextval('global_id_seq'),
label TEXT,
description TEXT,
media TEXT,
mediaType TEXT,
externalId BIGINT
);