72 lines
1.6 KiB
SQL
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 propertys (
|
|
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,
|
|
propertyGroupId 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
|
|
);
|
|
|