diff --git a/docs/db/Schema_data_migration.txt b/docs/db/Schema_data_migration.txt index 740478f471f4d9d3c7f590f057a82c101070744c..0ea427cc7b164df949dfd4d71f239ffdbfcdd912 100644 --- a/docs/db/Schema_data_migration.txt +++ b/docs/db/Schema_data_migration.txt @@ -25,147 +25,147 @@ -- -------------------------------------------------------------------------------- -- structures -- -------------------------------------------------------------------------------- -CREATE TABLE systemgroup ( +CREATE TABLE IF NOT EXISTS systemgroup ( id bigint NOT NULL, version integer, - uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE system ( +CREATE TABLE IF NOT EXISTS system ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE subsystem ( +CREATE TABLE IF NOT EXISTS subsystem ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -- -------------------------------------------------------------------------------- -CREATE TABLE discipline ( +CREATE TABLE IF NOT EXISTS discipline ( id bigint NOT NULL, version integer, - uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE devicegroup ( +CREATE TABLE IF NOT EXISTS devicegroup ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE devicetype ( +CREATE TABLE IF NOT EXISTS devicetype ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -- -------------------------------------------------------------------------------- -- name -- -------------------------------------------------------------------------------- -CREATE TABLE name ( +CREATE TABLE IF NOT EXISTS name ( id bigint NOT NULL, version integer, - uuid character varying(255), - systemgroup_uuid character varying(255), - system_uuid character varying(255), - subsystem_uuid character varying(255), - devicetype_uuid character varying(255), - instance_index character varying(255), - convention_name character varying(255), - convention_name_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + systemgroup_uuid text, + system_uuid text, + subsystem_uuid text, + devicetype_uuid text, + instance_index text, + convention_name text, + convention_name_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -- -------------------------------------------------------------------------------- @@ -492,47 +492,47 @@ select np.id from namepart np, namepartrevision npr where np.id = npr.namepart_i -- -------------------------------------------------------------------------------- -- index -- -------------------------------------------------------------------------------- -CREATE INDEX systemgroup_id_idx ON public.systemgroup (id); -CREATE INDEX systemgroup_uuid_idx ON public.systemgroup (uuid); -CREATE INDEX systemgroup_mnemonic_idx ON public.systemgroup (mnemonic); -CREATE INDEX systemgroup_status_idx ON public.systemgroup (status); -CREATE INDEX systemgroup_deleted_idx ON public.systemgroup (deleted); - -CREATE INDEX system_id_idx ON public.system (id); -CREATE INDEX system_uuid_idx ON public.system (uuid); -CREATE INDEX system_parent_uuid_idx ON public.system (parent_uuid); -CREATE INDEX system_mnemonic_idx ON public.system (mnemonic); -CREATE INDEX system_status_idx ON public.system (status); -CREATE INDEX system_deleted_idx ON public.system (deleted); - -CREATE INDEX subsystem_id_idx ON public.subsystem (id); -CREATE INDEX subsystem_uuid_idx ON public.subsystem (uuid); -CREATE INDEX subsystem_parent_uuid_idx ON public.subsystem (parent_uuid); -CREATE INDEX subsystem_mnemonic_idx ON public.subsystem (mnemonic); -CREATE INDEX subsystem_status_idx ON public.subsystem (status); -CREATE INDEX subsystem_deleted_idx ON public.subsystem (deleted); - -CREATE INDEX discipline_id_idx ON public.discipline (id); -CREATE INDEX discipline_uuid_idx ON public.discipline (uuid); -CREATE INDEX discipline_mnemonic_idx ON public.discipline (mnemonic); -CREATE INDEX discipline_status_idx ON public.discipline (status); -CREATE INDEX discipline_deleted_idx ON public.discipline (deleted); - -CREATE INDEX devicegroup_id_idx ON public.devicegroup (id); -CREATE INDEX devicegroup_uuid_idx ON public.devicegroup (uuid); -CREATE INDEX devicegroup_parent_uuid_idx ON public.devicegroup (parent_uuid); -CREATE INDEX devicegroup_mnemonic_idx ON public.devicegroup (mnemonic); -CREATE INDEX devicegroup_status_idx ON public.devicegroup (status); -CREATE INDEX devicegroup_deleted_idx ON public.devicegroup (deleted); - -CREATE INDEX devicetype_id_idx ON public.devicetype (id); -CREATE INDEX devicetype_uuid_idx ON public.devicetype (uuid); -CREATE INDEX devicetype_parent_uuid_idx ON public.devicetype (parent_uuid); -CREATE INDEX devicetype_mnemonic_idx ON public.devicetype (mnemonic); -CREATE INDEX devicetype_status_idx ON public.devicetype (status); -CREATE INDEX devicetype_deleted_idx ON public.devicetype (deleted); - -CREATE INDEX name_uuid_idx ON public.name (uuid); +CREATE INDEX systemgroup_id_idx ON systemgroup (id); +CREATE INDEX systemgroup_uuid_idx ON systemgroup (uuid); +CREATE INDEX systemgroup_mnemonic_idx ON systemgroup (mnemonic); +CREATE INDEX systemgroup_status_idx ON systemgroup (status); +CREATE INDEX systemgroup_deleted_idx ON systemgroup (deleted); + +CREATE INDEX system_id_idx ON system (id); +CREATE INDEX system_uuid_idx ON system (uuid); +CREATE INDEX system_parent_uuid_idx ON system (parent_uuid); +CREATE INDEX system_mnemonic_idx ON system (mnemonic); +CREATE INDEX system_status_idx ON system (status); +CREATE INDEX system_deleted_idx ON system (deleted); + +CREATE INDEX subsystem_id_idx ON subsystem (id); +CREATE INDEX subsystem_uuid_idx ON subsystem (uuid); +CREATE INDEX subsystem_parent_uuid_idx ON subsystem (parent_uuid); +CREATE INDEX subsystem_mnemonic_idx ON subsystem (mnemonic); +CREATE INDEX subsystem_status_idx ON subsystem (status); +CREATE INDEX subsystem_deleted_idx ON subsystem (deleted); + +CREATE INDEX discipline_id_idx ON discipline (id); +CREATE INDEX discipline_uuid_idx ON discipline (uuid); +CREATE INDEX discipline_mnemonic_idx ON discipline (mnemonic); +CREATE INDEX discipline_status_idx ON discipline (status); +CREATE INDEX discipline_deleted_idx ON discipline (deleted); + +CREATE INDEX devicegroup_id_idx ON devicegroup (id); +CREATE INDEX devicegroup_uuid_idx ON devicegroup (uuid); +CREATE INDEX devicegroup_parent_uuid_idx ON devicegroup (parent_uuid); +CREATE INDEX devicegroup_mnemonic_idx ON devicegroup (mnemonic); +CREATE INDEX devicegroup_status_idx ON devicegroup (status); +CREATE INDEX devicegroup_deleted_idx ON devicegroup (deleted); + +CREATE INDEX devicetype_id_idx ON devicetype (id); +CREATE INDEX devicetype_uuid_idx ON devicetype (uuid); +CREATE INDEX devicetype_parent_uuid_idx ON devicetype (parent_uuid); +CREATE INDEX devicetype_mnemonic_idx ON devicetype (mnemonic); +CREATE INDEX devicetype_status_idx ON devicetype (status); +CREATE INDEX devicetype_deleted_idx ON devicetype (deleted); + +CREATE INDEX name_uuid_idx ON name (uuid); -- -------------------------------------------------------------------------------- -- latest @@ -568,24 +568,24 @@ update name en set latest = true where en.id = ( -- -------------------------------------------------------------------------------- -- index -- -------------------------------------------------------------------------------- -CREATE INDEX name_id_idx ON public.name (id); -CREATE INDEX name_namepartrevision_systemgroup_uuid_idx ON public.name (systemgroup_uuid); -CREATE INDEX name_namepartrevision_system_uuid_idx ON public.name (system_uuid); -CREATE INDEX name_namepartrevision_subsystem_uuid_idx ON public.name (subsystem_uuid); -CREATE INDEX name_namepartrevision_devicetype_uuid_idx ON public.name (devicetype_uuid); -CREATE INDEX name_convention_name_idx ON public.name (convention_name); -CREATE INDEX name_status_idx ON public.name (status); -CREATE INDEX name_deleted_idx ON public.name (deleted); +CREATE INDEX name_id_idx ON name (id); +CREATE INDEX name_namepartrevision_systemgroup_uuid_idx ON name (systemgroup_uuid); +CREATE INDEX name_namepartrevision_system_uuid_idx ON name (system_uuid); +CREATE INDEX name_namepartrevision_subsystem_uuid_idx ON name (subsystem_uuid); +CREATE INDEX name_namepartrevision_devicetype_uuid_idx ON name (devicetype_uuid); +CREATE INDEX name_convention_name_idx ON name (convention_name); +CREATE INDEX name_status_idx ON name (status); +CREATE INDEX name_deleted_idx ON name (deleted); -CREATE INDEX systemgroup_latest_idx ON public.systemgroup (latest); -CREATE INDEX system_latest_idx ON public.system (latest); -CREATE INDEX subsystem_latest_idx ON public.subsystem (latest); +CREATE INDEX systemgroup_latest_idx ON systemgroup (latest); +CREATE INDEX system_latest_idx ON system (latest); +CREATE INDEX subsystem_latest_idx ON subsystem (latest); -CREATE INDEX discipline_latest_idx ON public.discipline (latest); -CREATE INDEX devicegroup_latest_idx ON public.devicegroup (latest); -CREATE INDEX devicetype_latest_idx ON public.devicetype (latest); +CREATE INDEX discipline_latest_idx ON discipline (latest); +CREATE INDEX devicegroup_latest_idx ON devicegroup (latest); +CREATE INDEX devicetype_latest_idx ON devicetype (latest); -CREATE INDEX name_latest_idx ON public.name (latest); +CREATE INDEX name_latest_idx ON name (latest); -- -------------------------------------------------------------------------------- -- sequence @@ -660,15 +660,15 @@ ALTER TABLE ONLY name ALTER COLUMN id SET DEFAULT nextval('name_id_seq'::regclas -- -------------------------------------------------------------------------------- -- primary key -- -------------------------------------------------------------------------------- -ALTER TABLE public.systemgroup ADD CONSTRAINT systemgroup_pk PRIMARY KEY (id); -ALTER TABLE public.system ADD CONSTRAINT system_pk PRIMARY KEY (id); -ALTER TABLE public.subsystem ADD CONSTRAINT subsystem_pk PRIMARY KEY (id); +ALTER TABLE systemgroup ADD CONSTRAINT systemgroup_pk PRIMARY KEY (id); +ALTER TABLE system ADD CONSTRAINT system_pk PRIMARY KEY (id); +ALTER TABLE subsystem ADD CONSTRAINT subsystem_pk PRIMARY KEY (id); -ALTER TABLE public.discipline ADD CONSTRAINT discipline_pk PRIMARY KEY (id); -ALTER TABLE public.devicegroup ADD CONSTRAINT devicegroup_pk PRIMARY KEY (id); -ALTER TABLE public.devicetype ADD CONSTRAINT devicetype_pk PRIMARY KEY (id); +ALTER TABLE discipline ADD CONSTRAINT discipline_pk PRIMARY KEY (id); +ALTER TABLE devicegroup ADD CONSTRAINT devicegroup_pk PRIMARY KEY (id); +ALTER TABLE devicetype ADD CONSTRAINT devicetype_pk PRIMARY KEY (id); -ALTER TABLE public.name ADD CONSTRAINT name_pk PRIMARY KEY (id); +ALTER TABLE name ADD CONSTRAINT name_pk PRIMARY KEY (id); -- -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- @@ -718,7 +718,7 @@ BEGIN END; $$; -CREATE OR REPLACE FUNCTION public.get_instance_index(convention_name text) +CREATE OR REPLACE FUNCTION get_instance_index(convention_name text) RETURNS text LANGUAGE plpgsql AS diff --git a/src/main/resources/db/migration/V4__Schema_data_migration.sql b/src/main/resources/db/migration/V4__Schema_data_migration.sql index 740478f471f4d9d3c7f590f057a82c101070744c..0ea427cc7b164df949dfd4d71f239ffdbfcdd912 100644 --- a/src/main/resources/db/migration/V4__Schema_data_migration.sql +++ b/src/main/resources/db/migration/V4__Schema_data_migration.sql @@ -25,147 +25,147 @@ -- -------------------------------------------------------------------------------- -- structures -- -------------------------------------------------------------------------------- -CREATE TABLE systemgroup ( +CREATE TABLE IF NOT EXISTS systemgroup ( id bigint NOT NULL, version integer, - uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE system ( +CREATE TABLE IF NOT EXISTS system ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE subsystem ( +CREATE TABLE IF NOT EXISTS subsystem ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -- -------------------------------------------------------------------------------- -CREATE TABLE discipline ( +CREATE TABLE IF NOT EXISTS discipline ( id bigint NOT NULL, version integer, - uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE devicegroup ( +CREATE TABLE IF NOT EXISTS devicegroup ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -CREATE TABLE devicetype ( +CREATE TABLE IF NOT EXISTS devicetype ( id bigint NOT NULL, version integer, - uuid character varying(255), - parent_uuid character varying(255), - name character varying(255), - mnemonic character varying(255), - mnemonic_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + parent_uuid text, + name text, + mnemonic text, + mnemonic_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -- -------------------------------------------------------------------------------- -- name -- -------------------------------------------------------------------------------- -CREATE TABLE name ( +CREATE TABLE IF NOT EXISTS name ( id bigint NOT NULL, version integer, - uuid character varying(255), - systemgroup_uuid character varying(255), - system_uuid character varying(255), - subsystem_uuid character varying(255), - devicetype_uuid character varying(255), - instance_index character varying(255), - convention_name character varying(255), - convention_name_equivalence character varying(255), - description character varying(255), - status character varying(255), + uuid text, + systemgroup_uuid text, + system_uuid text, + subsystem_uuid text, + devicetype_uuid text, + instance_index text, + convention_name text, + convention_name_equivalence text, + description text, + status text, latest boolean NOT NULL, deleted boolean NOT NULL, requested timestamp without time zone, - requested_by character varying(255), - requested_comment character varying(255), + requested_by text, + requested_comment text, processed timestamp without time zone, - processed_by character varying(255), - processed_comment character varying(255) + processed_by text, + processed_comment text ); -- -------------------------------------------------------------------------------- @@ -492,47 +492,47 @@ select np.id from namepart np, namepartrevision npr where np.id = npr.namepart_i -- -------------------------------------------------------------------------------- -- index -- -------------------------------------------------------------------------------- -CREATE INDEX systemgroup_id_idx ON public.systemgroup (id); -CREATE INDEX systemgroup_uuid_idx ON public.systemgroup (uuid); -CREATE INDEX systemgroup_mnemonic_idx ON public.systemgroup (mnemonic); -CREATE INDEX systemgroup_status_idx ON public.systemgroup (status); -CREATE INDEX systemgroup_deleted_idx ON public.systemgroup (deleted); - -CREATE INDEX system_id_idx ON public.system (id); -CREATE INDEX system_uuid_idx ON public.system (uuid); -CREATE INDEX system_parent_uuid_idx ON public.system (parent_uuid); -CREATE INDEX system_mnemonic_idx ON public.system (mnemonic); -CREATE INDEX system_status_idx ON public.system (status); -CREATE INDEX system_deleted_idx ON public.system (deleted); - -CREATE INDEX subsystem_id_idx ON public.subsystem (id); -CREATE INDEX subsystem_uuid_idx ON public.subsystem (uuid); -CREATE INDEX subsystem_parent_uuid_idx ON public.subsystem (parent_uuid); -CREATE INDEX subsystem_mnemonic_idx ON public.subsystem (mnemonic); -CREATE INDEX subsystem_status_idx ON public.subsystem (status); -CREATE INDEX subsystem_deleted_idx ON public.subsystem (deleted); - -CREATE INDEX discipline_id_idx ON public.discipline (id); -CREATE INDEX discipline_uuid_idx ON public.discipline (uuid); -CREATE INDEX discipline_mnemonic_idx ON public.discipline (mnemonic); -CREATE INDEX discipline_status_idx ON public.discipline (status); -CREATE INDEX discipline_deleted_idx ON public.discipline (deleted); - -CREATE INDEX devicegroup_id_idx ON public.devicegroup (id); -CREATE INDEX devicegroup_uuid_idx ON public.devicegroup (uuid); -CREATE INDEX devicegroup_parent_uuid_idx ON public.devicegroup (parent_uuid); -CREATE INDEX devicegroup_mnemonic_idx ON public.devicegroup (mnemonic); -CREATE INDEX devicegroup_status_idx ON public.devicegroup (status); -CREATE INDEX devicegroup_deleted_idx ON public.devicegroup (deleted); - -CREATE INDEX devicetype_id_idx ON public.devicetype (id); -CREATE INDEX devicetype_uuid_idx ON public.devicetype (uuid); -CREATE INDEX devicetype_parent_uuid_idx ON public.devicetype (parent_uuid); -CREATE INDEX devicetype_mnemonic_idx ON public.devicetype (mnemonic); -CREATE INDEX devicetype_status_idx ON public.devicetype (status); -CREATE INDEX devicetype_deleted_idx ON public.devicetype (deleted); - -CREATE INDEX name_uuid_idx ON public.name (uuid); +CREATE INDEX systemgroup_id_idx ON systemgroup (id); +CREATE INDEX systemgroup_uuid_idx ON systemgroup (uuid); +CREATE INDEX systemgroup_mnemonic_idx ON systemgroup (mnemonic); +CREATE INDEX systemgroup_status_idx ON systemgroup (status); +CREATE INDEX systemgroup_deleted_idx ON systemgroup (deleted); + +CREATE INDEX system_id_idx ON system (id); +CREATE INDEX system_uuid_idx ON system (uuid); +CREATE INDEX system_parent_uuid_idx ON system (parent_uuid); +CREATE INDEX system_mnemonic_idx ON system (mnemonic); +CREATE INDEX system_status_idx ON system (status); +CREATE INDEX system_deleted_idx ON system (deleted); + +CREATE INDEX subsystem_id_idx ON subsystem (id); +CREATE INDEX subsystem_uuid_idx ON subsystem (uuid); +CREATE INDEX subsystem_parent_uuid_idx ON subsystem (parent_uuid); +CREATE INDEX subsystem_mnemonic_idx ON subsystem (mnemonic); +CREATE INDEX subsystem_status_idx ON subsystem (status); +CREATE INDEX subsystem_deleted_idx ON subsystem (deleted); + +CREATE INDEX discipline_id_idx ON discipline (id); +CREATE INDEX discipline_uuid_idx ON discipline (uuid); +CREATE INDEX discipline_mnemonic_idx ON discipline (mnemonic); +CREATE INDEX discipline_status_idx ON discipline (status); +CREATE INDEX discipline_deleted_idx ON discipline (deleted); + +CREATE INDEX devicegroup_id_idx ON devicegroup (id); +CREATE INDEX devicegroup_uuid_idx ON devicegroup (uuid); +CREATE INDEX devicegroup_parent_uuid_idx ON devicegroup (parent_uuid); +CREATE INDEX devicegroup_mnemonic_idx ON devicegroup (mnemonic); +CREATE INDEX devicegroup_status_idx ON devicegroup (status); +CREATE INDEX devicegroup_deleted_idx ON devicegroup (deleted); + +CREATE INDEX devicetype_id_idx ON devicetype (id); +CREATE INDEX devicetype_uuid_idx ON devicetype (uuid); +CREATE INDEX devicetype_parent_uuid_idx ON devicetype (parent_uuid); +CREATE INDEX devicetype_mnemonic_idx ON devicetype (mnemonic); +CREATE INDEX devicetype_status_idx ON devicetype (status); +CREATE INDEX devicetype_deleted_idx ON devicetype (deleted); + +CREATE INDEX name_uuid_idx ON name (uuid); -- -------------------------------------------------------------------------------- -- latest @@ -568,24 +568,24 @@ update name en set latest = true where en.id = ( -- -------------------------------------------------------------------------------- -- index -- -------------------------------------------------------------------------------- -CREATE INDEX name_id_idx ON public.name (id); -CREATE INDEX name_namepartrevision_systemgroup_uuid_idx ON public.name (systemgroup_uuid); -CREATE INDEX name_namepartrevision_system_uuid_idx ON public.name (system_uuid); -CREATE INDEX name_namepartrevision_subsystem_uuid_idx ON public.name (subsystem_uuid); -CREATE INDEX name_namepartrevision_devicetype_uuid_idx ON public.name (devicetype_uuid); -CREATE INDEX name_convention_name_idx ON public.name (convention_name); -CREATE INDEX name_status_idx ON public.name (status); -CREATE INDEX name_deleted_idx ON public.name (deleted); +CREATE INDEX name_id_idx ON name (id); +CREATE INDEX name_namepartrevision_systemgroup_uuid_idx ON name (systemgroup_uuid); +CREATE INDEX name_namepartrevision_system_uuid_idx ON name (system_uuid); +CREATE INDEX name_namepartrevision_subsystem_uuid_idx ON name (subsystem_uuid); +CREATE INDEX name_namepartrevision_devicetype_uuid_idx ON name (devicetype_uuid); +CREATE INDEX name_convention_name_idx ON name (convention_name); +CREATE INDEX name_status_idx ON name (status); +CREATE INDEX name_deleted_idx ON name (deleted); -CREATE INDEX systemgroup_latest_idx ON public.systemgroup (latest); -CREATE INDEX system_latest_idx ON public.system (latest); -CREATE INDEX subsystem_latest_idx ON public.subsystem (latest); +CREATE INDEX systemgroup_latest_idx ON systemgroup (latest); +CREATE INDEX system_latest_idx ON system (latest); +CREATE INDEX subsystem_latest_idx ON subsystem (latest); -CREATE INDEX discipline_latest_idx ON public.discipline (latest); -CREATE INDEX devicegroup_latest_idx ON public.devicegroup (latest); -CREATE INDEX devicetype_latest_idx ON public.devicetype (latest); +CREATE INDEX discipline_latest_idx ON discipline (latest); +CREATE INDEX devicegroup_latest_idx ON devicegroup (latest); +CREATE INDEX devicetype_latest_idx ON devicetype (latest); -CREATE INDEX name_latest_idx ON public.name (latest); +CREATE INDEX name_latest_idx ON name (latest); -- -------------------------------------------------------------------------------- -- sequence @@ -660,15 +660,15 @@ ALTER TABLE ONLY name ALTER COLUMN id SET DEFAULT nextval('name_id_seq'::regclas -- -------------------------------------------------------------------------------- -- primary key -- -------------------------------------------------------------------------------- -ALTER TABLE public.systemgroup ADD CONSTRAINT systemgroup_pk PRIMARY KEY (id); -ALTER TABLE public.system ADD CONSTRAINT system_pk PRIMARY KEY (id); -ALTER TABLE public.subsystem ADD CONSTRAINT subsystem_pk PRIMARY KEY (id); +ALTER TABLE systemgroup ADD CONSTRAINT systemgroup_pk PRIMARY KEY (id); +ALTER TABLE system ADD CONSTRAINT system_pk PRIMARY KEY (id); +ALTER TABLE subsystem ADD CONSTRAINT subsystem_pk PRIMARY KEY (id); -ALTER TABLE public.discipline ADD CONSTRAINT discipline_pk PRIMARY KEY (id); -ALTER TABLE public.devicegroup ADD CONSTRAINT devicegroup_pk PRIMARY KEY (id); -ALTER TABLE public.devicetype ADD CONSTRAINT devicetype_pk PRIMARY KEY (id); +ALTER TABLE discipline ADD CONSTRAINT discipline_pk PRIMARY KEY (id); +ALTER TABLE devicegroup ADD CONSTRAINT devicegroup_pk PRIMARY KEY (id); +ALTER TABLE devicetype ADD CONSTRAINT devicetype_pk PRIMARY KEY (id); -ALTER TABLE public.name ADD CONSTRAINT name_pk PRIMARY KEY (id); +ALTER TABLE name ADD CONSTRAINT name_pk PRIMARY KEY (id); -- -------------------------------------------------------------------------------- -- -------------------------------------------------------------------------------- @@ -718,7 +718,7 @@ BEGIN END; $$; -CREATE OR REPLACE FUNCTION public.get_instance_index(convention_name text) +CREATE OR REPLACE FUNCTION get_instance_index(convention_name text) RETURNS text LANGUAGE plpgsql AS