summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 15:09:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-14 15:09:44 +0000
commit874ead9c3a50de4c4ca4551eaf5b7eb976d26b50 (patch)
tree637ee9f2da5e251bc08ebf3e972209d51966bf7c /db
parent2e4c4055181eec9186458dd5dd3219c937032ec7 (diff)
downloadgitlab-ce-874ead9c3a50de4c4ca4551eaf5b7eb976d26b50.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb9
-rw-r--r--db/migrate/20200326122700_create_diff_note_positions.rb31
-rw-r--r--db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb24
-rw-r--r--db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb24
-rw-r--r--db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb24
-rw-r--r--db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb17
-rw-r--r--db/structure.sql52
7 files changed, 181 insertions, 0 deletions
diff --git a/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb b/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb
new file mode 100644
index 00000000000..60da96ccf33
--- /dev/null
+++ b/db/migrate/20200325111432_add_issues_create_limit_to_application_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddIssuesCreateLimitToApplicationSettings < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :issues_create_limit, :integer, default: 300, null: false
+ end
+end
diff --git a/db/migrate/20200326122700_create_diff_note_positions.rb b/db/migrate/20200326122700_create_diff_note_positions.rb
new file mode 100644
index 00000000000..87159e666b5
--- /dev/null
+++ b/db/migrate/20200326122700_create_diff_note_positions.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+class CreateDiffNotePositions < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ create_table :diff_note_positions do |t|
+ t.references :note, foreign_key: { on_delete: :cascade }, null: false, index: false
+ t.integer :old_line
+ t.integer :new_line
+ t.integer :diff_content_type, limit: 2, null: false
+ t.integer :diff_type, limit: 2, null: false
+ t.string :line_code, limit: 255, null: false
+ t.binary :base_sha, null: false
+ t.binary :start_sha, null: false
+ t.binary :head_sha, null: false
+ t.text :old_path, null: false
+ t.text :new_path, null: false
+
+ t.index [:note_id, :diff_type], unique: true
+ end
+ end
+ end
+
+ def down
+ drop_table :diff_note_positions
+ end
+end
diff --git a/db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb b/db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb
new file mode 100644
index 00000000000..78b5832fea4
--- /dev/null
+++ b/db/migrate/20200406165950_add_not_null_constraint_on_file_store_to_lfs_objects.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintOnFileStoreToLfsObjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONSTRAINT_NAME = 'lfs_objects_file_store_not_null'
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE lfs_objects ADD CONSTRAINT #{CONSTRAINT_NAME} CHECK (file_store IS NOT NULL) NOT VALID;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE lfs_objects DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME};
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb b/db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb
new file mode 100644
index 00000000000..1d44e5c17b3
--- /dev/null
+++ b/db/migrate/20200406171857_add_not_null_constraint_on_file_store_to_ci_job_artifacts.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintOnFileStoreToCiJobArtifacts < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONSTRAINT_NAME = 'ci_job_artifacts_file_store_not_null'
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE ci_job_artifacts ADD CONSTRAINT #{CONSTRAINT_NAME} CHECK (file_store IS NOT NULL) NOT VALID;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE ci_job_artifacts DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME};
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb b/db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb
new file mode 100644
index 00000000000..aa498ba9c89
--- /dev/null
+++ b/db/migrate/20200406172135_add_not_null_constraint_on_file_store_to_uploads.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class AddNotNullConstraintOnFileStoreToUploads < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ CONSTRAINT_NAME = 'uploads_store_not_null'
+ DOWNTIME = false
+
+ def up
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE uploads ADD CONSTRAINT #{CONSTRAINT_NAME} CHECK (store IS NOT NULL) NOT VALID;
+ SQL
+ end
+ end
+
+ def down
+ with_lock_retries do
+ execute <<~SQL
+ ALTER TABLE uploads DROP CONSTRAINT IF EXISTS #{CONSTRAINT_NAME};
+ SQL
+ end
+ end
+end
diff --git a/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb b/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb
new file mode 100644
index 00000000000..2cc91efcc36
--- /dev/null
+++ b/db/migrate/20200408153842_add_index_on_creator_id_and_id_on_projects.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnCreatorIdAndIdOnProjects < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :projects, [:creator_id, :id]
+ end
+
+ def down
+ remove_concurrent_index :projects, [:creator_id, :id]
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 895afed92e6..cfa0f3c405a 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -397,6 +397,7 @@ CREATE TABLE public.application_settings (
email_restrictions text,
npm_package_requests_forwarding boolean DEFAULT true NOT NULL,
namespace_storage_size_limit bigint DEFAULT 0 NOT NULL,
+ issues_create_limit integer DEFAULT 300 NOT NULL,
seat_link_enabled boolean DEFAULT true NOT NULL,
container_expiration_policies_enable_historic_entries boolean DEFAULT false NOT NULL
);
@@ -2138,6 +2139,30 @@ CREATE SEQUENCE public.design_user_mentions_id_seq
ALTER SEQUENCE public.design_user_mentions_id_seq OWNED BY public.design_user_mentions.id;
+CREATE TABLE public.diff_note_positions (
+ id bigint NOT NULL,
+ note_id bigint NOT NULL,
+ old_line integer,
+ new_line integer,
+ diff_content_type smallint NOT NULL,
+ diff_type smallint NOT NULL,
+ line_code character varying(255) NOT NULL,
+ base_sha bytea NOT NULL,
+ start_sha bytea NOT NULL,
+ head_sha bytea NOT NULL,
+ old_path text NOT NULL,
+ new_path text NOT NULL
+);
+
+CREATE SEQUENCE public.diff_note_positions_id_seq
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.diff_note_positions_id_seq OWNED BY public.diff_note_positions.id;
+
CREATE TABLE public.draft_notes (
id bigint NOT NULL,
merge_request_id integer NOT NULL,
@@ -7124,6 +7149,8 @@ ALTER TABLE ONLY public.design_management_versions ALTER COLUMN id SET DEFAULT n
ALTER TABLE ONLY public.design_user_mentions ALTER COLUMN id SET DEFAULT nextval('public.design_user_mentions_id_seq'::regclass);
+ALTER TABLE ONLY public.diff_note_positions ALTER COLUMN id SET DEFAULT nextval('public.diff_note_positions_id_seq'::regclass);
+
ALTER TABLE ONLY public.draft_notes ALTER COLUMN id SET DEFAULT nextval('public.draft_notes_id_seq'::regclass);
ALTER TABLE ONLY public.emails ALTER COLUMN id SET DEFAULT nextval('public.emails_id_seq'::regclass);
@@ -7670,6 +7697,9 @@ ALTER TABLE ONLY public.ci_daily_report_results
ALTER TABLE ONLY public.ci_group_variables
ADD CONSTRAINT ci_group_variables_pkey PRIMARY KEY (id);
+ALTER TABLE public.ci_job_artifacts
+ ADD CONSTRAINT ci_job_artifacts_file_store_not_null CHECK ((file_store IS NOT NULL)) NOT VALID;
+
ALTER TABLE ONLY public.ci_job_artifacts
ADD CONSTRAINT ci_job_artifacts_pkey PRIMARY KEY (id);
@@ -7829,6 +7859,9 @@ ALTER TABLE ONLY public.design_management_versions
ALTER TABLE ONLY public.design_user_mentions
ADD CONSTRAINT design_user_mentions_pkey PRIMARY KEY (id);
+ALTER TABLE ONLY public.diff_note_positions
+ ADD CONSTRAINT diff_note_positions_pkey PRIMARY KEY (id);
+
ALTER TABLE ONLY public.draft_notes
ADD CONSTRAINT draft_notes_pkey PRIMARY KEY (id);
@@ -8024,6 +8057,9 @@ ALTER TABLE ONLY public.ldap_group_links
ALTER TABLE ONLY public.lfs_file_locks
ADD CONSTRAINT lfs_file_locks_pkey PRIMARY KEY (id);
+ALTER TABLE public.lfs_objects
+ ADD CONSTRAINT lfs_objects_file_store_not_null CHECK ((file_store IS NOT NULL)) NOT VALID;
+
ALTER TABLE ONLY public.lfs_objects
ADD CONSTRAINT lfs_objects_pkey PRIMARY KEY (id);
@@ -8417,6 +8453,9 @@ ALTER TABLE ONLY public.u2f_registrations
ALTER TABLE ONLY public.uploads
ADD CONSTRAINT uploads_pkey PRIMARY KEY (id);
+ALTER TABLE public.uploads
+ ADD CONSTRAINT uploads_store_not_null CHECK ((store IS NOT NULL)) NOT VALID;
+
ALTER TABLE ONLY public.user_agent_details
ADD CONSTRAINT user_agent_details_pkey PRIMARY KEY (id);
@@ -9086,6 +9125,8 @@ CREATE UNIQUE INDEX index_design_management_versions_on_sha_and_issue_id ON publ
CREATE UNIQUE INDEX index_design_user_mentions_on_note_id ON public.design_user_mentions USING btree (note_id);
+CREATE UNIQUE INDEX index_diff_note_positions_on_note_id_and_diff_type ON public.diff_note_positions USING btree (note_id, diff_type);
+
CREATE INDEX index_draft_notes_on_author_id ON public.draft_notes USING btree (author_id);
CREATE INDEX index_draft_notes_on_discussion_id ON public.draft_notes USING btree (discussion_id);
@@ -9886,6 +9927,8 @@ CREATE INDEX index_projects_on_creator_id_and_created_at ON public.projects USIN
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);
+
CREATE INDEX index_projects_on_description_trigram ON public.projects USING gin (description public.gin_trgm_ops);
CREATE INDEX index_projects_on_id_and_archived_and_pending_delete ON public.projects USING btree (id) WHERE ((archived = false) AND (pending_delete = false));
@@ -11068,6 +11111,9 @@ ALTER TABLE ONLY public.project_statistics
ALTER TABLE ONLY public.user_details
ADD CONSTRAINT fk_rails_12e0b3043d FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+ALTER TABLE ONLY public.diff_note_positions
+ ADD CONSTRAINT fk_rails_13c7212859 FOREIGN KEY (note_id) REFERENCES public.notes(id) ON DELETE CASCADE;
+
ALTER TABLE ONLY public.users_security_dashboard_projects
ADD CONSTRAINT fk_rails_150cd5682c FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
@@ -13064,10 +13110,12 @@ COPY "schema_migrations" (version) FROM STDIN;
20200323134519
20200324093258
20200324115359
+20200325111432
20200325152327
20200325160952
20200325183636
20200326114443
+20200326122700
20200326124443
20200326134443
20200326135443
@@ -13090,10 +13138,14 @@ COPY "schema_migrations" (version) FROM STDIN;
20200403185127
20200403185422
20200406135648
+20200406165950
+20200406171857
+20200406172135
20200406192059
20200407094005
20200407094923
20200408110856
+20200408153842
20200408175424
\.