diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 15:07:53 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-31 15:07:53 +0000 |
commit | d7a028e20d29b8c6d0e780ac168544dfbb712d3c (patch) | |
tree | f9fc9ea12e166aec6c4ffe476ba7a3566396b696 /db | |
parent | 0d0cddc9ce20c5a7d8a2723d0aa620ca184a711a (diff) | |
download | gitlab-ce-d7a028e20d29b8c6d0e780ac168544dfbb712d3c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
8 files changed, 192 insertions, 1 deletions
diff --git a/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb b/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb new file mode 100644 index 00000000000..e8f7a693e99 --- /dev/null +++ b/db/migrate/20200314060834_add_scanned_resources_count_to_security_scan.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true +class AddScannedResourcesCountToSecurityScan < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column :security_scans, :scanned_resources_count, :integer + end + + def down + remove_column :security_scans, :scanned_resources_count + end +end diff --git a/db/migrate/20200326114443_create_jira_imports_table.rb b/db/migrate/20200326114443_create_jira_imports_table.rb new file mode 100644 index 00000000000..e114bd513f4 --- /dev/null +++ b/db/migrate/20200326114443_create_jira_imports_table.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class CreateJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def change + create_table :jira_imports do |t| + t.integer :project_id, null: false, limit: 8 + t.integer :user_id, limit: 8 + t.integer :label_id, limit: 8 + t.timestamps_with_timezone + t.datetime_with_timezone :finished_at + t.integer :jira_project_xid, null: false, limit: 8 + t.integer :total_issue_count, null: false, default: 0, limit: 4 + t.integer :imported_issues_count, null: false, default: 0, limit: 4 + t.integer :failed_to_import_count, null: false, default: 0, limit: 4 + t.integer :status, limit: 2, null: false, default: 0 + t.string :jid, limit: 255 + t.string :jira_project_key, null: false, limit: 255 + t.string :jira_project_name, null: false, limit: 255 + end + + add_index :jira_imports, [:project_id, :jira_project_key], name: 'index_jira_imports_on_project_id_and_jira_project_key' + end +end diff --git a/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb new file mode 100644 index 00000000000..6410f530b30 --- /dev/null +++ b/db/migrate/20200326124443_add_projects_fk_to_jira_imports_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddProjectsFkToJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :jira_imports, :projects, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :jira_imports, :projects + end + end +end diff --git a/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb new file mode 100644 index 00000000000..0956a8e814b --- /dev/null +++ b/db/migrate/20200326134443_add_users_fk_to_jira_imports_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddUsersFkToJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :jira_imports, :users, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :jira_imports, :users + end + end +end diff --git a/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb b/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb new file mode 100644 index 00000000000..5a26672f305 --- /dev/null +++ b/db/migrate/20200326135443_add_users_fk_index_on_jira_imports_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddUsersFkIndexOnJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :jira_imports, :user_id + end + + def down + remove_concurrent_index :jira_imports, :user_id + end +end diff --git a/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb new file mode 100644 index 00000000000..ead04100a96 --- /dev/null +++ b/db/migrate/20200326144443_add_labels_fk_to_jira_imports_table.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddLabelsFkToJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + with_lock_retries do + add_foreign_key :jira_imports, :labels, on_delete: :nullify # rubocop:disable Migration/AddConcurrentForeignKey + end + end + + def down + with_lock_retries do + remove_foreign_key :jira_imports, :labels + end + end +end diff --git a/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb b/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb new file mode 100644 index 00000000000..d71c6f07989 --- /dev/null +++ b/db/migrate/20200326145443_add_labels_fk_index_on_jira_imports_table.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddLabelsFkIndexOnJiraImportsTable < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :jira_imports, :label_id + end + + def down + remove_concurrent_index :jira_imports, :label_id + end +end diff --git a/db/structure.sql b/db/structure.sql index 6c807ccc5df..1a4b8582ab0 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3304,6 +3304,33 @@ CREATE SEQUENCE public.jira_connect_subscriptions_id_seq ALTER SEQUENCE public.jira_connect_subscriptions_id_seq OWNED BY public.jira_connect_subscriptions.id; +CREATE TABLE public.jira_imports ( + id bigint NOT NULL, + project_id bigint NOT NULL, + user_id bigint, + label_id bigint, + created_at timestamp with time zone NOT NULL, + updated_at timestamp with time zone NOT NULL, + finished_at timestamp with time zone, + jira_project_xid bigint NOT NULL, + total_issue_count integer DEFAULT 0 NOT NULL, + imported_issues_count integer DEFAULT 0 NOT NULL, + failed_to_import_count integer DEFAULT 0 NOT NULL, + status smallint DEFAULT 0 NOT NULL, + jid character varying(255), + jira_project_key character varying(255) NOT NULL, + jira_project_name character varying(255) NOT NULL +); + +CREATE SEQUENCE public.jira_imports_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER SEQUENCE public.jira_imports_id_seq OWNED BY public.jira_imports.id; + CREATE TABLE public.jira_tracker_data ( id bigint NOT NULL, service_id integer NOT NULL, @@ -5558,7 +5585,8 @@ CREATE TABLE public.security_scans ( created_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL, build_id bigint NOT NULL, - scan_type smallint NOT NULL + scan_type smallint NOT NULL, + scanned_resources_count integer ); CREATE SEQUENCE public.security_scans_id_seq @@ -7119,6 +7147,8 @@ ALTER TABLE ONLY public.jira_connect_installations ALTER COLUMN id SET DEFAULT n ALTER TABLE ONLY public.jira_connect_subscriptions ALTER COLUMN id SET DEFAULT nextval('public.jira_connect_subscriptions_id_seq'::regclass); +ALTER TABLE ONLY public.jira_imports ALTER COLUMN id SET DEFAULT nextval('public.jira_imports_id_seq'::regclass); + ALTER TABLE ONLY public.jira_tracker_data ALTER COLUMN id SET DEFAULT nextval('public.jira_tracker_data_id_seq'::regclass); ALTER TABLE ONLY public.keys ALTER COLUMN id SET DEFAULT nextval('public.keys_id_seq'::regclass); @@ -7872,6 +7902,9 @@ ALTER TABLE ONLY public.jira_connect_installations ALTER TABLE ONLY public.jira_connect_subscriptions ADD CONSTRAINT jira_connect_subscriptions_pkey PRIMARY KEY (id); +ALTER TABLE ONLY public.jira_imports + ADD CONSTRAINT jira_imports_pkey PRIMARY KEY (id); + ALTER TABLE ONLY public.jira_tracker_data ADD CONSTRAINT jira_tracker_data_pkey PRIMARY KEY (id); @@ -9243,6 +9276,12 @@ CREATE UNIQUE INDEX index_jira_connect_installations_on_client_key ON public.jir CREATE INDEX index_jira_connect_subscriptions_on_namespace_id ON public.jira_connect_subscriptions USING btree (namespace_id); +CREATE INDEX index_jira_imports_on_label_id ON public.jira_imports USING btree (label_id); + +CREATE INDEX index_jira_imports_on_project_id_and_jira_project_key ON public.jira_imports USING btree (project_id, jira_project_key); + +CREATE INDEX index_jira_imports_on_user_id ON public.jira_imports USING btree (user_id); + CREATE INDEX index_jira_tracker_data_on_service_id ON public.jira_tracker_data USING btree (service_id); CREATE UNIQUE INDEX index_keys_on_fingerprint ON public.keys USING btree (fingerprint); @@ -11218,6 +11257,9 @@ ALTER TABLE ONLY public.deployment_clusters ALTER TABLE ONLY public.evidences ADD CONSTRAINT fk_rails_6388b435a6 FOREIGN KEY (release_id) REFERENCES public.releases(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.jira_imports + ADD CONSTRAINT fk_rails_63cbe52ada FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; + ALTER TABLE ONLY public.vulnerability_occurrence_pipelines ADD CONSTRAINT fk_rails_6421e35d7d FOREIGN KEY (pipeline_id) REFERENCES public.ci_pipelines(id) ON DELETE CASCADE; @@ -11257,6 +11299,9 @@ ALTER TABLE ONLY public.operations_feature_flags_clients ALTER TABLE ONLY public.web_hook_logs ADD CONSTRAINT fk_rails_666826e111 FOREIGN KEY (web_hook_id) REFERENCES public.web_hooks(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.jira_imports + ADD CONSTRAINT fk_rails_675d38c03b FOREIGN KEY (label_id) REFERENCES public.labels(id) ON DELETE SET NULL; + ALTER TABLE ONLY public.geo_hashed_storage_migrated_events ADD CONSTRAINT fk_rails_687ed7d7c5 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; @@ -11671,6 +11716,9 @@ ALTER TABLE ONLY public.vulnerability_issue_links ALTER TABLE ONLY public.geo_hashed_storage_attachments_events ADD CONSTRAINT fk_rails_d496b088e9 FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE; +ALTER TABLE ONLY public.jira_imports + ADD CONSTRAINT fk_rails_da617096ce FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL; + ALTER TABLE ONLY public.dependency_proxy_blobs ADD CONSTRAINT fk_rails_db58bbc5d7 FOREIGN KEY (group_id) REFERENCES public.namespaces(id) ON DELETE CASCADE; @@ -12826,6 +12874,7 @@ COPY "schema_migrations" (version) FROM STDIN; 20200312163407 20200313101649 20200313123934 +20200314060834 20200316111759 20200316162648 20200316173312 @@ -12854,5 +12903,11 @@ COPY "schema_migrations" (version) FROM STDIN; 20200325152327 20200325160952 20200325183636 +20200326114443 +20200326124443 +20200326134443 +20200326135443 +20200326144443 +20200326145443 \. |