Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 15:07:43 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-27 15:07:43 +0300
commit39fa7d1eeb2dba52f0601128f3ac91f57d19866e (patch)
treeda042d34ff762dd1957e51666a34202295a081b9 /db
parent6ac4a6713ed3196af899011f7e18658e16ebaac0 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200305200641_create_terraform_states.rb14
-rw-r--r--db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb21
-rw-r--r--db/structure.sql32
3 files changed, 67 insertions, 0 deletions
diff --git a/db/migrate/20200305200641_create_terraform_states.rb b/db/migrate/20200305200641_create_terraform_states.rb
new file mode 100644
index 00000000000..3e137369e33
--- /dev/null
+++ b/db/migrate/20200305200641_create_terraform_states.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateTerraformStates < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ create_table :terraform_states do |t|
+ t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: false
+ t.timestamps_with_timezone null: false
+ t.integer :file_store, limit: 2
+ t.string :file, limit: 255
+ end
+ end
+end
diff --git a/db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb b/db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb
new file mode 100644
index 00000000000..7e15c3ad11d
--- /dev/null
+++ b/db/migrate/20200325160952_add_index_on_name_type_eq_ci_build_to_ci_builds.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddIndexOnNameTypeEqCiBuildToCiBuilds < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_builds_on_name_and_security_type_eq_ci_build'
+
+ def up
+ add_concurrent_index :ci_builds, [:name, :id],
+ name: INDEX_NAME,
+ 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)"
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_builds, INDEX_NAME
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index bb291590abc..a972ef7085a 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -5976,6 +5976,24 @@ CREATE SEQUENCE public.term_agreements_id_seq
ALTER SEQUENCE public.term_agreements_id_seq OWNED BY public.term_agreements.id;
+CREATE TABLE public.terraform_states (
+ id bigint NOT NULL,
+ project_id bigint NOT NULL,
+ created_at timestamp with time zone NOT NULL,
+ updated_at timestamp with time zone NOT NULL,
+ file_store smallint,
+ file character varying(255)
+);
+
+CREATE SEQUENCE public.terraform_states_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.terraform_states_id_seq OWNED BY public.terraform_states.id;
+
CREATE TABLE public.timelogs (
id integer NOT NULL,
time_spent integer NOT NULL,
@@ -7329,6 +7347,8 @@ ALTER TABLE ONLY public.tags ALTER COLUMN id SET DEFAULT nextval('public.tags_id
ALTER TABLE ONLY public.term_agreements ALTER COLUMN id SET DEFAULT nextval('public.term_agreements_id_seq'::regclass);
+ALTER TABLE ONLY public.terraform_states ALTER COLUMN id SET DEFAULT nextval('public.terraform_states_id_seq'::regclass);
+
ALTER TABLE ONLY public.timelogs ALTER COLUMN id SET DEFAULT nextval('public.timelogs_id_seq'::regclass);
ALTER TABLE ONLY public.todos ALTER COLUMN id SET DEFAULT nextval('public.todos_id_seq'::regclass);
@@ -8230,6 +8250,9 @@ ALTER TABLE ONLY public.tags
ALTER TABLE ONLY public.term_agreements
ADD CONSTRAINT term_agreements_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.terraform_states
+ ADD CONSTRAINT terraform_states_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.timelogs
ADD CONSTRAINT timelogs_pkey PRIMARY KEY (id);
@@ -8604,6 +8627,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_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_name_for_security_reports_values ON public.ci_builds USING btree (name) 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]));
CREATE INDEX index_ci_builds_on_project_id_and_id ON public.ci_builds USING btree (project_id, id);
@@ -9972,6 +9997,8 @@ 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_timelogs_on_issue_id ON public.timelogs USING btree (issue_id);
CREATE INDEX index_timelogs_on_merge_request_id ON public.timelogs USING btree (merge_request_id);
@@ -11277,6 +11304,9 @@ ALTER TABLE ONLY public.pages_domain_acme_orders
ALTER TABLE ONLY public.ci_subscriptions_projects
ADD CONSTRAINT fk_rails_7871f9a97b FOREIGN KEY (upstream_project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.terraform_states
+ ADD CONSTRAINT fk_rails_78f54ca485 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.software_license_policies
ADD CONSTRAINT fk_rails_7a7a2a92de FOREIGN KEY (software_license_id) REFERENCES public.software_licenses(id) ON DELETE CASCADE;
@@ -12749,6 +12779,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200304211738
20200305121159
20200305151736
+20200305200641
20200306095654
20200306160521
20200306170211
@@ -12807,5 +12838,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200323122201
20200323134519
20200324115359
+20200325160952
\.