|
|
|
@@ -0,0 +1,747 @@
|
|
|
|
|
-- DROP SCHEMA public;
|
|
|
|
|
|
|
|
|
|
CREATE SCHEMA public AUTHORIZATION pg_database_owner;
|
|
|
|
|
|
|
|
|
|
COMMENT ON SCHEMA public IS 'standard public schema';
|
|
|
|
|
|
|
|
|
|
-- DROP SEQUENCE public.calculations_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.calculations_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.condition_application_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.condition_application_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.conditions_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.conditions_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.languages_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.languages_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.meta_fieldcatalog_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.meta_fieldcatalog_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.product_type_groups_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.product_type_groups_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.product_type_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.product_type_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.product_type_structure_nodes_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.product_type_structure_nodes_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.property_type_group_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.property_type_group_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.property_types_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.property_types_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.row_descriptions_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.row_descriptions_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.rules_list_product_type_set_amount_of_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.rules_list_product_type_set_amount_of_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.units_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.units_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.values_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.values_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;
|
|
|
|
|
-- DROP SEQUENCE public.values_type_id_seq;
|
|
|
|
|
|
|
|
|
|
CREATE SEQUENCE public.values_type_id_seq
|
|
|
|
|
INCREMENT BY 1
|
|
|
|
|
MINVALUE 1
|
|
|
|
|
MAXVALUE 2147483647
|
|
|
|
|
START 1
|
|
|
|
|
CACHE 1
|
|
|
|
|
NO CYCLE;-- public.calculations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.calculations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.calculations (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL, -- Bezeichner der Kalkulationsdefinition
|
|
|
|
|
description varchar NULL, -- Beschreibung der Kalkulationsvorschrift
|
|
|
|
|
formula varchar NOT NULL, -- Formel der kalkulation:¶{field_id}+-*/[row_id]¶Die Werte aus der jeweiligen Spalte werden genommen.
|
|
|
|
|
CONSTRAINT calculations_formula_not_null NOT NULL formula,
|
|
|
|
|
CONSTRAINT calculations_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT calculations_pk PRIMARY KEY (id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.calculations IS 'Kalkulationsdefinitionen für Kalkulationsspalten';
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.calculations."label" IS 'Bezeichner der Kalkulationsdefinition';
|
|
|
|
|
COMMENT ON COLUMN public.calculations.description IS 'Beschreibung der Kalkulationsvorschrift';
|
|
|
|
|
COMMENT ON COLUMN public.calculations.formula IS 'Formel der kalkulation:
|
|
|
|
|
{field_id}+-*/[row_id]
|
|
|
|
|
Die Werte aus der jeweiligen Spalte werden genommen.';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.condition_applications definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.condition_applications;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.condition_applications (
|
|
|
|
|
id int4 DEFAULT nextval('condition_application_id_seq'::regclass) NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
CONSTRAINT condition_application_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT condition_application_pk PRIMARY KEY (id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.condition_applications IS 'Z.B. Preisliste Deutschland';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.languages definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.languages;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.languages (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
locale varchar NULL, -- Sprachlokalisierung der ausgewählten Sprache, z.B. "de-DE" für Deutsch
|
|
|
|
|
"language" varchar NULL, -- Name/Bezeichnung der Sprache
|
|
|
|
|
CONSTRAINT languages_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT languages_pk PRIMARY KEY (id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.languages IS 'Sprachtabelle
|
|
|
|
|
Liste der zur Verfügung gestellten Sprachen.';
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.languages.locale IS 'Sprachlokalisierung der ausgewählten Sprache, z.B. "de-DE" für Deutsch';
|
|
|
|
|
COMMENT ON COLUMN public.languages."language" IS 'Name/Bezeichnung der Sprache';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.meta_condition_fields definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.meta_condition_fields;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.meta_condition_fields (
|
|
|
|
|
id int4 DEFAULT nextval('meta_fieldcatalog_id_seq'::regclass) NOT NULL,
|
|
|
|
|
table_name varchar NOT NULL,
|
|
|
|
|
table_field varchar NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
CONSTRAINT meta_fieldcatalog_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT meta_fieldcatalog_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT meta_fieldcatalog_table_field_not_null NOT NULL table_field,
|
|
|
|
|
CONSTRAINT meta_fieldcatalog_table_name_not_null NOT NULL table_name
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.meta_condition_fields IS 'Felder für die Konditionsbeschreibung';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_types definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_types;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_types (
|
|
|
|
|
id int4 DEFAULT nextval('product_type_id_seq'::regclass) NOT NULL,
|
|
|
|
|
product_identifierer varchar NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
CONSTRAINT product_type_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT product_type_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT product_type_product_identifierer_not_null NOT NULL product_identifierer,
|
|
|
|
|
CONSTRAINT product_type_unique UNIQUE (product_identifierer)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.product_types IS 'Ein Produkttyp besteht aus Propertytypen, ggf. Strukturknoten, die Unterprodukttypen enthalten können und/oder Auswahlknoten, die ebenfalls Unterprodukttypen enthalten können';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.value_types definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.value_types;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.value_types (
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
id int4 DEFAULT nextval('values_type_id_seq'::regclass) NOT NULL,
|
|
|
|
|
CONSTRAINT values_type_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT values_types_pk PRIMARY KEY (id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.conditions definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.conditions;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.conditions (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
application_id int4 NULL,
|
|
|
|
|
key_value varchar NOT NULL, -- String als semikolon separierte Liste von Schlüssel-ids, definiert über die Tabele condition_keys mit der entsprechenden condition_id
|
|
|
|
|
value float4 NOT NULL, -- Wert der Kondition
|
|
|
|
|
CONSTRAINT condition_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT conditions_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT conditions_key_value_not_null NOT NULL key_value,
|
|
|
|
|
CONSTRAINT conditions_value_not_null NOT NULL value,
|
|
|
|
|
CONSTRAINT conditions_condition_application_fk FOREIGN KEY (application_id) REFERENCES public.condition_applications(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.conditions.key_value IS 'String als semikolon separierte Liste von Schlüssel-ids, definiert über die Tabele condition_keys mit der entsprechenden condition_id';
|
|
|
|
|
COMMENT ON COLUMN public.conditions.value IS 'Wert der Kondition';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.meta_condition_keys definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.meta_condition_keys;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.meta_condition_keys (
|
|
|
|
|
field_id int4 NOT NULL,
|
|
|
|
|
condition_position int4 NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
condition_key_id int4 NOT NULL,
|
|
|
|
|
CONSTRAINT meta_condition_keys_condition_key_id_not_null NOT NULL condition_key_id,
|
|
|
|
|
CONSTRAINT meta_condition_keys_field_id_not_null NOT NULL field_id,
|
|
|
|
|
CONSTRAINT meta_condition_keys_meta_condition_fields_fk FOREIGN KEY (field_id) REFERENCES public.meta_condition_fields(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.meta_condition_keys IS 'Keydefinition für Konditionen';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_groups definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_groups;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_groups (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
parent_group_id int4 NULL,
|
|
|
|
|
is_visible bool DEFAULT true NOT NULL,
|
|
|
|
|
CONSTRAINT product_type_groups_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT product_type_groups_is_visible_not_null NOT NULL is_visible,
|
|
|
|
|
CONSTRAINT product_type_groups_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT product_type_groups_product_type_groups_fk FOREIGN KEY (parent_group_id) REFERENCES public.product_type_groups(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.product_type_groups IS 'Produktgruppe. Sie enthält die Property_types für die jeweiligen Produkte als Kopiervorlage';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_is_part_of definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_is_part_of;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_is_part_of (
|
|
|
|
|
product_type_id int4 NOT NULL, -- Komponenten-ID
|
|
|
|
|
is_part_of_product_tyoe_id int4 NOT NULL,
|
|
|
|
|
"number" int4 DEFAULT 1 NOT NULL,
|
|
|
|
|
min_number int4 DEFAULT 0 NOT NULL,
|
|
|
|
|
max_number int4 DEFAULT 1 NOT NULL,
|
|
|
|
|
CONSTRAINT product_type_is_part_of_is_part_of_product_tyoe_id_not_null NOT NULL is_part_of_product_tyoe_id,
|
|
|
|
|
CONSTRAINT product_type_is_part_of_max_number_not_null NOT NULL max_number,
|
|
|
|
|
CONSTRAINT product_type_is_part_of_min_number_not_null NOT NULL min_number,
|
|
|
|
|
CONSTRAINT product_type_is_part_of_number_not_null NOT NULL number,
|
|
|
|
|
CONSTRAINT product_type_is_part_of_product_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT product_type_is_part_of_unique UNIQUE (product_type_id, is_part_of_product_tyoe_id),
|
|
|
|
|
CONSTRAINT product_type_is_part_of_product_types_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id),
|
|
|
|
|
CONSTRAINT product_type_is_part_of_product_types_fk_1 FOREIGN KEY (is_part_of_product_tyoe_id) REFERENCES public.product_types(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.product_type_is_part_of IS 'Hat Teile Beziehung';
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.product_type_is_part_of.product_type_id IS 'Komponenten-ID';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_structure_nodes definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_structure_nodes;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_structure_nodes (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
is_one_off_structure bool DEFAULT false NOT NULL,
|
|
|
|
|
product_type_id int4 NOT NULL, -- Zu welchem Produkt gehört diese Struktur
|
|
|
|
|
CONSTRAINT product_type_structure_nodes_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT product_type_structure_nodes_is_one_off_structure_not_null NOT NULL is_one_off_structure,
|
|
|
|
|
CONSTRAINT product_type_structure_nodes_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT product_type_structure_nodes_product_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT product_type_structure_nodes_product_types_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.product_type_structure_nodes IS 'Strukturknoten für unterprodukte';
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.product_type_structure_nodes.product_type_id IS 'Zu welchem Produkt gehört diese Struktur';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_translations (
|
|
|
|
|
product_type_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT product_type_translations_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT product_type_translations_property_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT product_type_translations_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT product_type_translations_product_type_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_types_group_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_types_group_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_types_group_translations (
|
|
|
|
|
product_types_group_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT product_types_group_translation_product_types_group_id_not_null NOT NULL product_types_group_id,
|
|
|
|
|
CONSTRAINT product_types_group_translations_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT product_types_group_translations_unique UNIQUE (product_types_group_id, language_id),
|
|
|
|
|
CONSTRAINT product_types_group_translations_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT product_types_group_translations_product_type_groups_fk FOREIGN KEY (product_types_group_id) REFERENCES public.product_type_groups(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.property_type_groups definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.property_type_groups;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.property_type_groups (
|
|
|
|
|
id int4 DEFAULT nextval('property_type_group_id_seq'::regclass) NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
parent_proper_type_group_id int4 NULL,
|
|
|
|
|
CONSTRAINT property_type_group_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT property_type_group_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT property_type_group_property_type_group_fk FOREIGN KEY (parent_proper_type_group_id) REFERENCES public.property_type_groups(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.property_types definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.property_types;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.property_types (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
value_type_id int4 NULL,
|
|
|
|
|
CONSTRAINT property_types_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT property_types_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT property_types_value_types_fk FOREIGN KEY (value_type_id) REFERENCES public.value_types(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.property_types IS 'Vorlage für Merkmale eines Produktes';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.row_descriptions definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.row_descriptions;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.row_descriptions (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
"position" int4 NOT NULL,
|
|
|
|
|
is_visible bool DEFAULT true NOT NULL,
|
|
|
|
|
field_id int4 NULL,
|
|
|
|
|
calculation_id int4 NULL,
|
|
|
|
|
is_editable bool DEFAULT false NOT NULL,
|
|
|
|
|
condition_id int4 NULL,
|
|
|
|
|
row_type int4 NULL, -- 1: field¶2: calculation¶3: condition
|
|
|
|
|
CONSTRAINT row_descriptions_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT row_descriptions_is_editable_not_null NOT NULL is_editable,
|
|
|
|
|
CONSTRAINT row_descriptions_is_visible_not_null NOT NULL is_visible,
|
|
|
|
|
CONSTRAINT row_descriptions_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT row_descriptions_position_not_null NOT NULL "position",
|
|
|
|
|
CONSTRAINT row_descriptions_calculations_fk FOREIGN KEY (calculation_id) REFERENCES public.calculations(id),
|
|
|
|
|
CONSTRAINT row_descriptions_conditions_fk FOREIGN KEY (condition_id) REFERENCES public.conditions(id),
|
|
|
|
|
CONSTRAINT row_descriptions_meta_condition_fields_fk FOREIGN KEY (field_id) REFERENCES public.meta_condition_fields(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.row_descriptions.row_type IS '1: field
|
|
|
|
|
2: calculation
|
|
|
|
|
3: condition';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.row_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.row_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.row_translations (
|
|
|
|
|
row_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT row_translations_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT row_translations_row_id_not_null NOT NULL row_id,
|
|
|
|
|
CONSTRAINT row_translations_unique UNIQUE (row_id, language_id),
|
|
|
|
|
CONSTRAINT row_translations_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT row_translations_row_descriptions_fk FOREIGN KEY (row_id) REFERENCES public.row_descriptions(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.rules_list_product_type_set_amount_of definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.rules_list_product_type_set_amount_of;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.rules_list_product_type_set_amount_of (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
product_type_id int4 NOT NULL, -- Produkt für das die Regel gelten soll
|
|
|
|
|
component_x_product_type_id int4 NOT NULL,
|
|
|
|
|
component_y_product_type_id int4 NOT NULL,
|
|
|
|
|
component_x_amount int4 DEFAULT 1 NOT NULL,
|
|
|
|
|
factor int4 DEFAULT 1 NOT NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
CONSTRAINT rules_list_product_type_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount__component_x_amount_not_null NOT NULL component_x_amount,
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount_of_factor_not_null NOT NULL factor,
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount_of_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount_of_product_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_component_x_product_type_i_not_null NOT NULL component_x_product_type_id,
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_component_y_product_type_i_not_null NOT NULL component_y_product_type_id,
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount_of_product_types_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id),
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount_of_product_types_fk_1 FOREIGN KEY (component_x_product_type_id) REFERENCES public.product_types(id),
|
|
|
|
|
CONSTRAINT rules_list_product_type_set_amount_of_product_types_fk_2 FOREIGN KEY (component_y_product_type_id) REFERENCES public.product_types(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.rules_list_product_type_set_amount_of IS 'In Solution product_type:
|
|
|
|
|
Ist die Komponente x mehr als a * vertreten (in dr Regel 1)
|
|
|
|
|
dann setzte amount of Komponente y auf a * factor (in der Regel auch 1)';
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.rules_list_product_type_set_amount_of.product_type_id IS 'Produkt für das die Regel gelten soll';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.structure_node_product_types_list definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.structure_node_product_types_list;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.structure_node_product_types_list (
|
|
|
|
|
structure_node_id int4 NOT NULL,
|
|
|
|
|
product_type_id int4 NOT NULL, -- Produkte in der Struktur
|
|
|
|
|
CONSTRAINT structure_node_product_types_list_product_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT structure_node_product_types_list_structure_node_id_not_null NOT NULL structure_node_id,
|
|
|
|
|
CONSTRAINT structure_node_product_types_list_product_type_structure_nodes_ FOREIGN KEY (structure_node_id) REFERENCES public.product_type_structure_nodes(id),
|
|
|
|
|
CONSTRAINT structure_node_product_types_list_product_types_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.structure_node_product_types_list IS 'Produkte in einem Strukturknoten';
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.structure_node_product_types_list.product_type_id IS 'Produkte in der Struktur';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.units definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.units;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.units (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL,
|
|
|
|
|
description varchar NULL,
|
|
|
|
|
unit varchar NULL,
|
|
|
|
|
base_unit_id int4 NULL, -- Wenn es eine Ableitung von einer Base-Unit ist, so kann diese hier verlinkt werden und dann wird der base_unit_factor berücksichtigt.
|
|
|
|
|
base_unit_factor float4 NULL, -- Von der Bas eaus betrachtet der Faktor, der für die Umrechnung benötigt wird.
|
|
|
|
|
CONSTRAINT units_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT units_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT units_units_fk FOREIGN KEY (base_unit_id) REFERENCES public.units(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public.units.base_unit_id IS 'Wenn es eine Ableitung von einer Base-Unit ist, so kann diese hier verlinkt werden und dann wird der base_unit_factor berücksichtigt.';
|
|
|
|
|
COMMENT ON COLUMN public.units.base_unit_factor IS 'Von der Bas eaus betrachtet der Faktor, der für die Umrechnung benötigt wird.';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public."values" definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public."values";
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public."values" (
|
|
|
|
|
id serial4 NOT NULL,
|
|
|
|
|
"label" varchar NULL, -- interne Bezeichnung
|
|
|
|
|
int_min_value int4 NULL, -- Kleinster oder einziger int_Wert
|
|
|
|
|
int_max_value int4 NULL, -- größter Wert, wenn Range
|
|
|
|
|
float_min_value float4 NULL,
|
|
|
|
|
float_max_value float4 NULL,
|
|
|
|
|
bool_value bool NULL,
|
|
|
|
|
value_type_id int4 NOT NULL,
|
|
|
|
|
value_translation_id int4 NULL, -- muss nicht gesetzt werden, z.B. bei Zahlen
|
|
|
|
|
is_range bool DEFAULT false NULL,
|
|
|
|
|
unit_id int4 NULL,
|
|
|
|
|
is_terminal bool NULL,
|
|
|
|
|
CONSTRAINT value_id_pk PRIMARY KEY (id),
|
|
|
|
|
CONSTRAINT values_id_not_null NOT NULL id,
|
|
|
|
|
CONSTRAINT values_value_type_id_not_null NOT NULL value_type_id,
|
|
|
|
|
CONSTRAINT values_units_fk FOREIGN KEY (unit_id) REFERENCES public.units(id),
|
|
|
|
|
CONSTRAINT values_values_type_fk FOREIGN KEY (value_type_id) REFERENCES public.value_types(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Column comments
|
|
|
|
|
|
|
|
|
|
COMMENT ON COLUMN public."values"."label" IS 'interne Bezeichnung';
|
|
|
|
|
COMMENT ON COLUMN public."values".int_min_value IS 'Kleinster oder einziger int_Wert';
|
|
|
|
|
COMMENT ON COLUMN public."values".int_max_value IS 'größter Wert, wenn Range';
|
|
|
|
|
COMMENT ON COLUMN public."values".value_translation_id IS 'muss nicht gesetzt werden, z.B. bei Zahlen';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_group_products_types_list definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_group_products_types_list;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_group_products_types_list (
|
|
|
|
|
product_type_group_id int4 NOT NULL,
|
|
|
|
|
product_type_id int4 NOT NULL,
|
|
|
|
|
is_mandatory bool DEFAULT false NOT NULL,
|
|
|
|
|
CONSTRAINT product_type_group_products_type_product_type_group_id_not_null NOT NULL product_type_group_id,
|
|
|
|
|
CONSTRAINT product_type_group_products_types_list_is_mandatory_not_null NOT NULL is_mandatory,
|
|
|
|
|
CONSTRAINT product_type_group_products_types_list_product_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT product_type_group_products_types_list_product_type_groups_fk FOREIGN KEY (product_type_group_id) REFERENCES public.product_type_groups(id),
|
|
|
|
|
CONSTRAINT product_type_group_products_types_list_product_types_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_structure_node_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_structure_node_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_structure_node_translations (
|
|
|
|
|
structure_node_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT product_type_structure_node_translat_structure_node_id_not_null NOT NULL structure_node_id,
|
|
|
|
|
CONSTRAINT product_type_structure_node_translations_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT product_type_structure_node_translations_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT product_type_structure_node_translations_product_type_structure FOREIGN KEY (structure_node_id) REFERENCES public.product_type_structure_nodes(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.product_type_values_list definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.product_type_values_list;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.product_type_values_list (
|
|
|
|
|
product_type_id int4 NOT NULL,
|
|
|
|
|
property_type_id int4 NOT NULL,
|
|
|
|
|
value_id int4 NOT NULL,
|
|
|
|
|
CONSTRAINT product_type_values_list_product_type_id_not_null NOT NULL product_type_id,
|
|
|
|
|
CONSTRAINT product_type_values_list_property_type_id_not_null NOT NULL property_type_id,
|
|
|
|
|
CONSTRAINT product_type_values_list_unique UNIQUE (product_type_id, property_type_id),
|
|
|
|
|
CONSTRAINT product_type_values_list_value_id_not_null NOT NULL value_id,
|
|
|
|
|
CONSTRAINT product_type_values_list_product_types_fk FOREIGN KEY (product_type_id) REFERENCES public.product_types(id),
|
|
|
|
|
CONSTRAINT product_type_values_list_property_types_fk FOREIGN KEY (property_type_id) REFERENCES public.property_types(id),
|
|
|
|
|
CONSTRAINT product_type_values_list_values_fk FOREIGN KEY (value_id) REFERENCES public."values"(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.property_type_group_list definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.property_type_group_list;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.property_type_group_list (
|
|
|
|
|
property_type_group_id int4 NOT NULL,
|
|
|
|
|
property_type_id int4 NOT NULL,
|
|
|
|
|
CONSTRAINT property_type_group_list_property_type_group_id_not_null NOT NULL property_type_group_id,
|
|
|
|
|
CONSTRAINT property_type_group_list_property_type_id_not_null NOT NULL property_type_id,
|
|
|
|
|
CONSTRAINT property_type_group_list_unique UNIQUE (property_type_group_id, property_type_id),
|
|
|
|
|
CONSTRAINT property_type_group_list_property_type_groups_fk FOREIGN KEY (property_type_group_id) REFERENCES public.property_type_groups(id),
|
|
|
|
|
CONSTRAINT property_type_group_list_property_types_fk FOREIGN KEY (property_type_id) REFERENCES public.property_types(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.property_type_group_list IS 'Properties einer Produktgruppe';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.property_type_group_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.property_type_group_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.property_type_group_translations (
|
|
|
|
|
property_type_group_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT property_type_group_translation_property_type_group_id_not_null NOT NULL property_type_group_id,
|
|
|
|
|
CONSTRAINT property_type_group_translations_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT property_type_group_translations_unique UNIQUE (property_type_group_id, language_id),
|
|
|
|
|
CONSTRAINT property_type_group_translations_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT property_type_group_translations_property_type_group_fk FOREIGN KEY (property_type_group_id) REFERENCES public.property_type_groups(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.property_type_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.property_type_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.property_type_translations (
|
|
|
|
|
property_type_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT property_type_translations_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT property_type_translations_unique UNIQUE (property_type_id, language_id),
|
|
|
|
|
CONSTRAINT property_type_translations_value_id_not_null NOT NULL property_type_id,
|
|
|
|
|
CONSTRAINT property_type_translations_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT property_type_translations_property_types_fk FOREIGN KEY (property_type_id) REFERENCES public.property_types(id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.value_lists definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.value_lists;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.value_lists (
|
|
|
|
|
property_type_id int4 NULL,
|
|
|
|
|
value_id int4 NULL,
|
|
|
|
|
CONSTRAINT value_lists_unique UNIQUE (property_type_id, value_id),
|
|
|
|
|
CONSTRAINT value_lists_property_types_fk FOREIGN KEY (property_type_id) REFERENCES public.property_types(id),
|
|
|
|
|
CONSTRAINT value_lists_values_fk FOREIGN KEY (value_id) REFERENCES public."values"(id)
|
|
|
|
|
);
|
|
|
|
|
COMMENT ON TABLE public.value_lists IS 'List of possilbe values';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- public.value_translations definition
|
|
|
|
|
|
|
|
|
|
-- Drop table
|
|
|
|
|
|
|
|
|
|
-- DROP TABLE public.value_translations;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE public.value_translations (
|
|
|
|
|
value_id int4 NOT NULL,
|
|
|
|
|
language_id int4 NOT NULL,
|
|
|
|
|
"translation" varchar NULL,
|
|
|
|
|
CONSTRAINT value_translation_language_id_not_null NOT NULL language_id,
|
|
|
|
|
CONSTRAINT value_translation_value_id_not_null NOT NULL value_id,
|
|
|
|
|
CONSTRAINT value_translations_unique UNIQUE (value_id, language_id),
|
|
|
|
|
CONSTRAINT value_translation_languages_fk FOREIGN KEY (language_id) REFERENCES public.languages(id),
|
|
|
|
|
CONSTRAINT value_translation_values_fk FOREIGN KEY (value_id) REFERENCES public."values"(id)
|
|
|
|
|
);
|