diff options
Diffstat (limited to 'db/structure.sql')
-rw-r--r-- | db/structure.sql | 98 |
1 files changed, 87 insertions, 11 deletions
diff --git a/db/structure.sql b/db/structure.sql index 83b01662530..89f0ab9c15d 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -400,7 +400,8 @@ CREATE TABLE public.application_settings ( seat_link_enabled boolean DEFAULT true NOT NULL, container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL, issues_create_limit integer DEFAULT 300 NOT NULL, - push_rule_id bigint + push_rule_id bigint, + group_owners_can_manage_default_branch_protection boolean DEFAULT true NOT NULL ); CREATE SEQUENCE public.application_settings_id_seq @@ -1662,7 +1663,9 @@ CREATE TABLE public.clusters_applications_fluentd ( updated_at timestamp with time zone NOT NULL, version character varying(255) NOT NULL, host character varying(255) NOT NULL, - status_reason text + status_reason text, + waf_log_enabled boolean DEFAULT true NOT NULL, + cilium_log_enabled boolean DEFAULT true NOT NULL ); CREATE SEQUENCE public.clusters_applications_fluentd_id_seq @@ -1867,7 +1870,9 @@ CREATE TABLE public.container_expiration_policies ( cadence character varying(12) DEFAULT '7d'::character varying NOT NULL, older_than character varying(12), keep_n integer, - enabled boolean DEFAULT true NOT NULL + enabled boolean DEFAULT true NOT NULL, + name_regex_keep text, + CONSTRAINT container_expiration_policies_name_regex_keep CHECK ((char_length(name_regex_keep) <= 255)) ); CREATE TABLE public.container_repositories ( @@ -4051,7 +4056,8 @@ CREATE TABLE public.namespaces ( mentions_disabled boolean, default_branch_protection smallint, unlock_membership_to_ldap boolean, - max_personal_access_token_lifetime integer + max_personal_access_token_lifetime integer, + push_rule_id bigint ); CREATE SEQUENCE public.namespaces_id_seq @@ -4596,6 +4602,28 @@ CREATE SEQUENCE public.pages_domains_id_seq ALTER SEQUENCE public.pages_domains_id_seq OWNED BY public.pages_domains.id; +CREATE TABLE public.partitioned_foreign_keys ( + id bigint NOT NULL, + cascade_delete boolean DEFAULT true NOT NULL, + from_table text NOT NULL, + from_column text NOT NULL, + to_table text NOT NULL, + to_column text NOT NULL, + CONSTRAINT check_2c2e02a62b CHECK ((char_length(from_column) <= 63)), + CONSTRAINT check_40738efb57 CHECK ((char_length(to_table) <= 63)), + CONSTRAINT check_741676d405 CHECK ((char_length(from_table) <= 63)), + CONSTRAINT check_7e98be694f CHECK ((char_length(to_column) <= 63)) +); + +CREATE SEQUENCE public.partitioned_foreign_keys_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.partitioned_foreign_keys_id_seq OWNED BY public.partitioned_foreign_keys.id; + CREATE TABLE public.path_locks ( id integer NOT NULL, path character varying NOT NULL, @@ -4884,7 +4912,8 @@ CREATE TABLE public.project_features ( updated_at timestamp without time zone, repository_access_level integer DEFAULT 20 NOT NULL, pages_access_level integer NOT NULL, - forking_access_level integer + forking_access_level integer, + metrics_dashboard_access_level integer ); CREATE SEQUENCE public.project_features_id_seq @@ -5816,7 +5845,8 @@ CREATE TABLE public.services ( description character varying(500), comment_on_event_enabled boolean DEFAULT true NOT NULL, template boolean DEFAULT false, - instance boolean DEFAULT false NOT NULL + instance boolean DEFAULT false NOT NULL, + comment_detail smallint ); CREATE SEQUENCE public.services_id_seq @@ -5998,7 +6028,9 @@ CREATE TABLE public.status_page_settings ( aws_region character varying(255) NOT NULL, aws_access_key character varying(255) NOT NULL, encrypted_aws_secret_key character varying(255) NOT NULL, - encrypted_aws_secret_key_iv character varying(255) NOT NULL + encrypted_aws_secret_key_iv character varying(255) NOT NULL, + status_page_url text, + CONSTRAINT check_75a79cd992 CHECK ((char_length(status_page_url) <= 1024)) ); CREATE SEQUENCE public.status_page_settings_project_id_seq @@ -6130,7 +6162,12 @@ CREATE TABLE public.terraform_states ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, file_store smallint, - file character varying(255) + file character varying(255), + lock_xid character varying(255), + locked_at timestamp with time zone, + locked_by_user_id bigint, + uuid character varying(32) NOT NULL, + name character varying(255) ); CREATE SEQUENCE public.terraform_states_id_seq @@ -7369,6 +7406,8 @@ ALTER TABLE ONLY public.pages_domain_acme_orders ALTER COLUMN id SET DEFAULT nex ALTER TABLE ONLY public.pages_domains ALTER COLUMN id SET DEFAULT nextval('public.pages_domains_id_seq'::regclass); +ALTER TABLE ONLY public.partitioned_foreign_keys ALTER COLUMN id SET DEFAULT nextval('public.partitioned_foreign_keys_id_seq'::regclass); + ALTER TABLE ONLY public.path_locks ALTER COLUMN id SET DEFAULT nextval('public.path_locks_id_seq'::regclass); ALTER TABLE ONLY public.personal_access_tokens ALTER COLUMN id SET DEFAULT nextval('public.personal_access_tokens_id_seq'::regclass); @@ -8197,6 +8236,9 @@ ALTER TABLE ONLY public.pages_domain_acme_orders ALTER TABLE ONLY public.pages_domains ADD CONSTRAINT pages_domains_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.partitioned_foreign_keys + ADD CONSTRAINT partitioned_foreign_keys_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.path_locks ADD CONSTRAINT path_locks_pkey PRIMARY KEY (id); @@ -8818,6 +8860,8 @@ CREATE INDEX index_ci_builds_on_commit_id_and_type_and_name_and_ref ON public.ci CREATE INDEX index_ci_builds_on_commit_id_and_type_and_ref ON public.ci_builds USING btree (commit_id, type, ref); +CREATE INDEX index_ci_builds_on_lock_version ON public.ci_builds USING btree (lock_version) WHERE (lock_version IS NULL); + CREATE INDEX index_ci_builds_on_name_and_security_type_eq_ci_build ON public.ci_builds USING btree (name, id) WHERE (((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)); CREATE INDEX index_ci_builds_on_project_id_and_id ON public.ci_builds USING btree (project_id, id); @@ -8894,6 +8938,8 @@ CREATE INDEX index_ci_pipelines_on_auto_canceled_by_id ON public.ci_pipelines US CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON public.ci_pipelines USING btree (external_pull_request_id) WHERE (external_pull_request_id IS NOT NULL); +CREATE INDEX index_ci_pipelines_on_lock_version ON public.ci_pipelines USING btree (lock_version) WHERE (lock_version IS NULL); + CREATE INDEX index_ci_pipelines_on_merge_request_id ON public.ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL); CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id ON public.ci_pipelines USING btree (pipeline_schedule_id); @@ -8962,6 +9008,8 @@ CREATE INDEX index_ci_sources_projects_on_pipeline_id ON public.ci_sources_proje CREATE UNIQUE INDEX index_ci_sources_projects_on_source_project_id_and_pipeline_id ON public.ci_sources_projects USING btree (source_project_id, pipeline_id); +CREATE INDEX index_ci_stages_on_lock_version ON public.ci_stages USING btree (lock_version) WHERE (lock_version IS NULL); + CREATE INDEX index_ci_stages_on_pipeline_id ON public.ci_stages USING btree (pipeline_id); CREATE UNIQUE INDEX index_ci_stages_on_pipeline_id_and_name ON public.ci_stages USING btree (pipeline_id, name); @@ -9364,6 +9412,8 @@ CREATE INDEX index_import_failures_on_correlation_id_value ON public.import_fail CREATE INDEX index_import_failures_on_group_id_not_null ON public.import_failures USING btree (group_id) WHERE (group_id IS NOT NULL); +CREATE INDEX index_import_failures_on_project_id_and_correlation_id_value ON public.import_failures USING btree (project_id, correlation_id_value) WHERE (retry_count = 0); + CREATE INDEX index_import_failures_on_project_id_not_null ON public.import_failures USING btree (project_id) WHERE (project_id IS NOT NULL); CREATE UNIQUE INDEX index_index_statuses_on_project_id ON public.index_statuses USING btree (project_id); @@ -9666,6 +9716,8 @@ CREATE INDEX index_namespaces_on_path_trigram ON public.namespaces USING gin (pa CREATE INDEX index_namespaces_on_plan_id ON public.namespaces USING btree (plan_id); +CREATE UNIQUE INDEX index_namespaces_on_push_rule_id ON public.namespaces USING btree (push_rule_id); + CREATE INDEX index_namespaces_on_require_two_factor_authentication ON public.namespaces USING btree (require_two_factor_authentication); CREATE UNIQUE INDEX index_namespaces_on_runners_token ON public.namespaces USING btree (runners_token); @@ -9800,6 +9852,8 @@ CREATE INDEX index_pages_domains_on_verified_at_and_enabled_until ON public.page CREATE INDEX index_pages_domains_on_wildcard ON public.pages_domains USING btree (wildcard); +CREATE UNIQUE INDEX index_partitioned_foreign_keys_unique_index ON public.partitioned_foreign_keys USING btree (to_table, from_table, from_column); + CREATE INDEX index_pat_on_user_id_and_expires_at ON public.personal_access_tokens USING btree (user_id, expires_at); CREATE INDEX index_path_locks_on_path ON public.path_locks USING btree (path); @@ -9926,8 +9980,6 @@ CREATE INDEX index_projects_api_vis20_updated_at ON public.projects USING btree CREATE INDEX index_projects_on_created_at_and_id ON public.projects USING btree (created_at, id); -CREATE INDEX index_projects_on_creator_id_and_created_at ON public.projects USING btree (creator_id, created_at); - CREATE INDEX index_projects_on_creator_id_and_created_at_and_id ON public.projects USING btree (creator_id, created_at, id); CREATE INDEX index_projects_on_creator_id_and_id ON public.projects USING btree (creator_id, id); @@ -10228,7 +10280,11 @@ CREATE INDEX index_term_agreements_on_term_id ON public.term_agreements USING bt CREATE INDEX index_term_agreements_on_user_id ON public.term_agreements USING btree (user_id); -CREATE INDEX index_terraform_states_on_project_id ON public.terraform_states USING btree (project_id); +CREATE INDEX index_terraform_states_on_locked_by_user_id ON public.terraform_states USING btree (locked_by_user_id); + +CREATE UNIQUE INDEX index_terraform_states_on_project_id_and_name ON public.terraform_states USING btree (project_id, name); + +CREATE UNIQUE INDEX index_terraform_states_on_uuid ON public.terraform_states USING btree (uuid); CREATE INDEX index_timelogs_on_issue_id ON public.timelogs USING btree (issue_id); @@ -10624,6 +10680,9 @@ ALTER TABLE ONLY public.merge_requests ALTER TABLE ONLY public.ci_group_variables ADD CONSTRAINT fk_33ae4d58d8 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.namespaces + ADD CONSTRAINT fk_3448c97865 FOREIGN KEY (push_rule_id) REFERENCES public.push_rules(id) ON DELETE SET NULL; + ALTER TABLE ONLY public.epics ADD CONSTRAINT fk_3654b61b03 FOREIGN KEY (author_id) REFERENCES public.users(id) ON DELETE CASCADE; @@ -11404,6 +11463,9 @@ ALTER TABLE ONLY public.geo_node_namespace_links ALTER TABLE ONLY public.clusters_applications_knative ADD CONSTRAINT fk_rails_54fc91e0a0 FOREIGN KEY (cluster_id) REFERENCES public.clusters(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.terraform_states + ADD CONSTRAINT fk_rails_558901b030 FOREIGN KEY (locked_by_user_id) REFERENCES public.users(id); + ALTER TABLE ONLY public.issue_user_mentions ADD CONSTRAINT fk_rails_57581fda73 FOREIGN KEY (issue_id) REFERENCES public.issues(id) ON DELETE CASCADE; @@ -12998,6 +13060,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200214214934 20200215222507 20200215225103 +20200217210353 20200217223651 20200217225719 20200219105209 @@ -13161,8 +13224,11 @@ COPY "schema_migrations" (version) FROM STDIN; 20200406193427 20200407094005 20200407094923 +20200407120000 +20200407121321 20200407171133 20200407171417 +20200407182205 20200408110856 20200408133211 20200408153842 @@ -13175,9 +13241,19 @@ COPY "schema_migrations" (version) FROM STDIN; 20200408154604 20200408154624 20200408175424 +20200408212219 +20200409085956 20200409211607 +20200410104828 +20200410232012 +20200413072059 +20200413230056 +20200414144547 20200415160722 20200415161021 20200415161206 +20200415192656 +20200416120128 +20200416120354 \. |