-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
CREATE TABLE system_tablegroup ( | ||
id BIGSERIAL PRIMARY KEY | ||
); | ||
|
||
CREATE TABLE system_tablegroup_lang ( | ||
id bigint REFERENCES system_tablegroup(id) ON DELETE CASCADE, | ||
langtag character varying(50), | ||
name character varying(255), | ||
description text, | ||
CONSTRAINT system_tablegroup_lang_pkey PRIMARY KEY (id, langtag) | ||
); | ||
|
||
CREATE TABLE system_table ( | ||
table_id BIGSERIAL PRIMARY KEY, | ||
user_table_name character varying(255) NOT NULL, | ||
is_hidden boolean DEFAULT false, | ||
ordering bigint DEFAULT currval('system_table_table_id_seq'::regclass), | ||
langtags text[], | ||
type text, | ||
group_id bigint REFERENCES system_tablegroup(id) ON DELETE SET NULL ON UPDATE CASCADE, | ||
attributes json NOT NULL DEFAULT '{}'::json | ||
); | ||
|
||
CREATE TABLE system_table_lang ( | ||
table_id bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
langtag character varying(50), | ||
name character varying(255), | ||
description text, | ||
CONSTRAINT system_table_lang_pkey PRIMARY KEY (table_id, langtag) | ||
); | ||
|
||
CREATE TABLE system_link_table ( | ||
link_id BIGSERIAL PRIMARY KEY, | ||
table_id_1 bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
table_id_2 bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
cardinality_1 integer DEFAULT 0 CHECK (cardinality_1 >= 0), | ||
cardinality_2 integer DEFAULT 0 CHECK (cardinality_2 >= 0), | ||
delete_cascade boolean DEFAULT false | ||
); | ||
|
||
CREATE TABLE system_columns ( | ||
table_id bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
column_id bigint, | ||
column_type character varying(255) NOT NULL, | ||
user_column_name character varying(255) NOT NULL, | ||
ordering bigint NOT NULL, | ||
link_id bigint REFERENCES system_link_table(link_id) ON DELETE CASCADE, | ||
multilanguage character varying(255), | ||
identifier boolean DEFAULT false, | ||
country_codes text[], | ||
format_pattern character varying(255), | ||
separator boolean NOT NULL DEFAULT false, | ||
attributes json NOT NULL DEFAULT '{}'::json, | ||
rules json NOT NULL DEFAULT '[]'::json, | ||
hidden boolean NOT NULL DEFAULT false, | ||
max_length integer, | ||
min_length integer, | ||
CONSTRAINT system_columns_pkey PRIMARY KEY (table_id, column_id) | ||
); | ||
|
||
CREATE TABLE system_columns_lang ( | ||
table_id bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
column_id bigint, | ||
langtag character varying(50), | ||
name character varying(255), | ||
description text, | ||
CONSTRAINT system_columns_lang_pkey PRIMARY KEY (table_id, column_id, langtag), | ||
CONSTRAINT system_columns_lang_table_id_column_id_fkey FOREIGN KEY (table_id, column_id) REFERENCES system_columns(table_id, column_id) ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE system_column_groups ( | ||
table_id bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
group_column_id bigint, | ||
grouped_column_id bigint, | ||
CONSTRAINT system_column_groups_table_id_grouped_column_id_fkey FOREIGN KEY (table_id, grouped_column_id) REFERENCES system_columns(table_id, column_id) ON DELETE CASCADE, | ||
CONSTRAINT system_column_groups_table_id_group_column_id_fkey FOREIGN KEY (table_id, group_column_id) REFERENCES system_columns(table_id, column_id) ON DELETE CASCADE, | ||
CONSTRAINT system_column_groups_pkey PRIMARY KEY (table_id, group_column_id, grouped_column_id) | ||
); | ||
|
||
CREATE TABLE folder ( | ||
id BIGSERIAL PRIMARY KEY, | ||
name character varying(255) NOT NULL, | ||
description character varying(255) NOT NULL, | ||
idparent bigint REFERENCES folder(id), | ||
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at timestamp without time zone | ||
); | ||
|
||
CREATE TABLE file ( | ||
uuid uuid PRIMARY KEY, | ||
idfolder bigint REFERENCES folder(id), | ||
tmp boolean NOT NULL DEFAULT true, | ||
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at timestamp without time zone | ||
); | ||
|
||
CREATE TABLE file_lang ( | ||
uuid uuid REFERENCES file(uuid) ON DELETE CASCADE, | ||
langtag character varying(50), | ||
title character varying(255), | ||
description character varying(255), | ||
internal_name character varying(255), | ||
external_name character varying(255), | ||
mime_type character varying(255), | ||
CONSTRAINT file_lang_pkey PRIMARY KEY (uuid, langtag) | ||
); | ||
|
||
CREATE TABLE system_attachment ( | ||
table_id bigint REFERENCES system_table(table_id) ON DELETE CASCADE, | ||
column_id bigint, | ||
row_id bigint, | ||
attachment_uuid uuid REFERENCES file(uuid) ON DELETE CASCADE, | ||
ordering bigint NOT NULL, | ||
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at timestamp without time zone, | ||
CONSTRAINT system_attachment_table_id_column_id_fkey FOREIGN KEY (table_id, column_id) REFERENCES system_columns(table_id, column_id) ON DELETE CASCADE, | ||
CONSTRAINT system_attachment_pkey PRIMARY KEY (table_id, column_id, row_id, attachment_uuid) | ||
); | ||
|
||
CREATE TABLE system_services ( | ||
id BIGSERIAL PRIMARY KEY, | ||
type character varying(50) NOT NULL, | ||
name character varying(255) NOT NULL UNIQUE, | ||
ordering bigint, | ||
displayname json, | ||
description json, | ||
active boolean DEFAULT true, | ||
config jsonb, | ||
scope jsonb, | ||
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
updated_at timestamp without time zone | ||
); | ||
|
||
CREATE TABLE system_settings ( | ||
key character varying(255) PRIMARY KEY, | ||
value text | ||
); | ||
|
||
INSERT INTO system_settings (key, value) VALUES ('langtags', $$["de-DE", "en-GB"]$$); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters