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>2019-10-22 14:31:16 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 14:31:16 +0300
commit905c1110b08f93a19661cf42a276c7ea90d0a0ff (patch)
tree756d138db422392c00471ab06acdff92c5a9b69c /db
parent50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff)
Add latest changes from gitlab-org/gitlab@12-4-stable-ee
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/17_cycle_analytics.rb8
-rw-r--r--db/migrate/20180113220114_rework_redirect_routes_indexes.rb4
-rw-r--r--db/migrate/20190801142441_add_throttle_protected_path_columns.rb25
-rw-r--r--db/migrate/20190807023052_design_issue_id_nullable.rb11
-rw-r--r--db/migrate/20190821040941_create_cluster_providers_aws.rb33
-rw-r--r--db/migrate/20190901174200_add_max_issue_count_to_list.rb16
-rw-r--r--db/migrate/20190903150358_create_analytics_repository_files_table.rb21
-rw-r--r--db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb29
-rw-r--r--db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb22
-rw-r--r--db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb29
-rw-r--r--db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb17
-rw-r--r--db/migrate/20190909045845_create_project_pages_metadata.rb14
-rw-r--r--db/migrate/20190911115056_add_projects_max_pages_size.rb9
-rw-r--r--db/migrate/20190911115109_add_namespaces_max_pages_size.rb9
-rw-r--r--db/migrate/20190911115207_add_projects_max_artifacts_size.rb9
-rw-r--r--db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb9
-rw-r--r--db/migrate/20190912223232_add_role_to_users.rb12
-rw-r--r--db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb13
-rw-r--r--db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb17
-rw-r--r--db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb16
-rw-r--r--db/migrate/20190918102042_create_grafana_integrations.rb15
-rw-r--r--db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb23
-rw-r--r--db/migrate/20190919091300_create_evidences.rb14
-rw-r--r--db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb29
-rw-r--r--db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb17
-rw-r--r--db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb18
-rw-r--r--db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb24
-rw-r--r--db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb9
-rw-r--r--db/migrate/20190925055714_default_request_access_groups.rb15
-rw-r--r--db/migrate/20190925055902_default_request_access_projects.rb15
-rw-r--r--db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb19
-rw-r--r--db/migrate/20190927055500_create_description_versions.rb29
-rw-r--r--db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb19
-rw-r--r--db/migrate/20190927074328_add_index_on_snippet_content.rb18
-rw-r--r--db/migrate/20190929180751_create_vulnerabilities.rb39
-rw-r--r--db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb14
-rw-r--r--db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb76
-rw-r--r--db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb30
-rw-r--r--db/migrate/20190930063627_add_management_project_id_to_clusters.rb9
-rw-r--r--db/migrate/20190930082942_add_new_release_to_notification_settings.rb9
-rw-r--r--db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb19
-rw-r--r--db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb21
-rw-r--r--db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb17
-rw-r--r--db/migrate/20191003064615_create_aws_roles.rb21
-rw-r--r--db/migrate/20191004133612_create_analytics_repository_file_commits.rb19
-rw-r--r--db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb17
-rw-r--r--db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb11
-rw-r--r--db/migrate/20191008180203_add_issuable_state_id_indexes.rb75
-rw-r--r--db/migrate/20191008200204_add_state_id_default_value.rb24
-rw-r--r--db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb13
-rw-r--r--db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb17
-rw-r--r--db/migrate/20191014132931_remove_index_on_snippets_project_id.rb17
-rw-r--r--db/migrate/20191016072826_replace_ci_trigger_requests_index.rb21
-rw-r--r--db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb22
-rw-r--r--db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb7
-rw-r--r--db/post_migrate/20190819231552_update_knative_prometheus_query_for_invocation_count.rb13
-rw-r--r--db/post_migrate/20190827102026_migrate_code_owner_approval_status_to_protected_branches_in_batches.rb46
-rw-r--r--db/post_migrate/20190905091812_schedule_project_any_approval_rule_migration.rb2
-rw-r--r--db/post_migrate/20190905091831_schedule_merge_request_any_approval_rule_migration.rb2
-rw-r--r--db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb32
-rw-r--r--db/post_migrate/20190911251732_sync_issuables_state_id.rb79
-rw-r--r--db/post_migrate/20190917173107_backfill_software_licenses_spdx_identifiers.rb57
-rw-r--r--db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb30
-rw-r--r--db/post_migrate/20191007163701_populate_remaining_any_approver_rules_for_merge_requests.rb44
-rw-r--r--db/post_migrate/20191007163736_populate_remaining_any_approver_rules_for_projects.rb44
-rw-r--r--db/schema.rb264
66 files changed, 1676 insertions, 22 deletions
diff --git a/db/fixtures/development/17_cycle_analytics.rb b/db/fixtures/development/17_cycle_analytics.rb
index 9d293f425e6..b7ddeef95b8 100644
--- a/db/fixtures/development/17_cycle_analytics.rb
+++ b/db/fixtures/development/17_cycle_analytics.rb
@@ -150,9 +150,11 @@ class Gitlab::Seeder::CycleAnalytics
::Git::BranchPushService.new(
issue.project,
@user,
- oldrev: issue.project.repository.commit("master").sha,
- newrev: commit_sha,
- ref: 'refs/heads/master'
+ change: {
+ oldrev: issue.project.repository.commit("master").sha,
+ newrev: commit_sha,
+ ref: 'refs/heads/master'
+ }
).execute
branch_name
diff --git a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
index 4c3bb0a26ce..2b9365ce827 100644
--- a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
+++ b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb
@@ -20,9 +20,7 @@ class ReworkRedirectRoutesIndexes < ActiveRecord::Migration[4.2]
def up
disable_statement_timeout do
# this is a plain btree on a single boolean column. It'll never be
- # selective enough to be valuable. This class is called by
- # setup_postgresql.rake so it needs to be able to handle this
- # index not existing.
+ # selective enough to be valuable.
if index_exists?(:redirect_routes, :permanent)
remove_concurrent_index(:redirect_routes, :permanent)
end
diff --git a/db/migrate/20190801142441_add_throttle_protected_path_columns.rb b/db/migrate/20190801142441_add_throttle_protected_path_columns.rb
new file mode 100644
index 00000000000..bb6d54f3b7b
--- /dev/null
+++ b/db/migrate/20190801142441_add_throttle_protected_path_columns.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+class AddThrottleProtectedPathColumns < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ DEFAULT_PROTECTED_PATHS = [
+ '/users/password',
+ '/users/sign_in',
+ '/api/v3/session.json',
+ '/api/v3/session',
+ '/api/v4/session.json',
+ '/api/v4/session',
+ '/users',
+ '/users/confirmation',
+ '/unsubscribes/',
+ '/import/github/personal_access_token'
+ ]
+
+ def change
+ add_column :application_settings, :throttle_protected_paths_enabled, :boolean, default: true, null: false
+ add_column :application_settings, :throttle_protected_paths_requests_per_period, :integer, default: 10, null: false
+ add_column :application_settings, :throttle_protected_paths_period_in_seconds, :integer, default: 60, null: false
+ add_column :application_settings, :protected_paths, :string, array: true, limit: 255, default: DEFAULT_PROTECTED_PATHS
+ end
+end
diff --git a/db/migrate/20190807023052_design_issue_id_nullable.rb b/db/migrate/20190807023052_design_issue_id_nullable.rb
new file mode 100644
index 00000000000..4429e23d520
--- /dev/null
+++ b/db/migrate/20190807023052_design_issue_id_nullable.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class DesignIssueIdNullable < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ change_column_null :design_management_designs, :issue_id, true
+ end
+end
diff --git a/db/migrate/20190821040941_create_cluster_providers_aws.rb b/db/migrate/20190821040941_create_cluster_providers_aws.rb
new file mode 100644
index 00000000000..f80559861c4
--- /dev/null
+++ b/db/migrate/20190821040941_create_cluster_providers_aws.rb
@@ -0,0 +1,33 @@
+# frozen_string_literal: true
+
+class CreateClusterProvidersAws < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ create_table :cluster_providers_aws do |t|
+ t.references :cluster, null: false, type: :bigint, index: { unique: true }, foreign_key: { on_delete: :cascade }
+ t.references :created_by_user, type: :integer, foreign_key: { on_delete: :nullify, to_table: :users }
+
+ t.integer :num_nodes, null: false
+ t.integer :status, null: false
+
+ t.timestamps_with_timezone null: false
+
+ t.string :key_name, null: false, limit: 255
+ t.string :role_arn, null: false, limit: 2048
+ t.string :region, null: false, limit: 255
+ t.string :vpc_id, null: false, limit: 255
+ t.string :subnet_ids, null: false, array: true, default: [], limit: 255
+ t.string :security_group_id, null: false, limit: 255
+ t.string :instance_type, null: false, limit: 255
+
+ t.string :access_key_id, limit: 255
+ t.string :encrypted_secret_access_key_iv, limit: 255
+ t.text :encrypted_secret_access_key
+ t.text :session_token
+ t.text :status_reason
+
+ t.index [:cluster_id, :status]
+ end
+ end
+end
diff --git a/db/migrate/20190901174200_add_max_issue_count_to_list.rb b/db/migrate/20190901174200_add_max_issue_count_to_list.rb
new file mode 100644
index 00000000000..59359f28d6a
--- /dev/null
+++ b/db/migrate/20190901174200_add_max_issue_count_to_list.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddMaxIssueCountToList < ActiveRecord::Migration[4.2]
+ include Gitlab::Database::MigrationHelpers
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+
+ def up
+ add_column_with_default :lists, :max_issue_count, :integer, default: 0
+ end
+
+ def down
+ remove_column :lists, :max_issue_count
+ end
+end
diff --git a/db/migrate/20190903150358_create_analytics_repository_files_table.rb b/db/migrate/20190903150358_create_analytics_repository_files_table.rb
new file mode 100644
index 00000000000..e7c30a149f9
--- /dev/null
+++ b/db/migrate/20190903150358_create_analytics_repository_files_table.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsRepositoryFilesTable < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :analytics_repository_files do |t|
+ t.references :project,
+ index: false,
+ foreign_key: { on_delete: :cascade },
+ null: false
+ t.string :file_path,
+ limit: 4096,
+ null: false
+ end
+
+ add_index :analytics_repository_files, [:project_id, :file_path], unique: true
+ end
+end
diff --git a/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb b/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb
new file mode 100644
index 00000000000..dca3fa1b37d
--- /dev/null
+++ b/db/migrate/20190903150435_create_analytics_repository_file_edits_table.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsRepositoryFileEditsTable < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :analytics_repository_file_edits do |t|
+ t.references :project,
+ index: true,
+ foreign_key: { on_delete: :cascade }, null: false
+ t.references :analytics_repository_file,
+ index: false,
+ foreign_key: { on_delete: :cascade },
+ null: false
+ t.date :committed_date,
+ null: false
+ t.integer :num_edits,
+ null: false,
+ default: 0
+ end
+
+ add_index :analytics_repository_file_edits,
+ [:analytics_repository_file_id, :committed_date, :project_id],
+ name: 'index_file_edits_on_committed_date_file_id_and_project_id',
+ unique: true
+ end
+end
diff --git a/db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb b/db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb
new file mode 100644
index 00000000000..861b97f0a09
--- /dev/null
+++ b/db/migrate/20190905022045_add_issues_prometheus_alert_event_join_table.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddIssuesPrometheusAlertEventJoinTable < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :issues_prometheus_alert_events, id: false do |t|
+ t.references :issue, null: false,
+ index: false, # Uses the index below
+ foreign_key: { on_delete: :cascade }
+ t.references :prometheus_alert_event, null: false,
+ index: { name: 'issue_id_issues_prometheus_alert_events_index' },
+ foreign_key: { on_delete: :cascade }
+
+ t.timestamps_with_timezone
+ t.index [:issue_id, :prometheus_alert_event_id],
+ unique: true, name: 'issue_id_prometheus_alert_event_id_index'
+ end
+ end
+end
diff --git a/db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb b/db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb
new file mode 100644
index 00000000000..e468b2decd9
--- /dev/null
+++ b/db/migrate/20190905074652_index_timestamp_columns_for_issue_metrics.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class IndexTimestampColumnsForIssueMetrics < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(*index_arguments)
+ end
+
+ def down
+ remove_concurrent_index(*index_arguments)
+ end
+
+ private
+
+ def index_arguments
+ [
+ :issue_metrics,
+ [:issue_id, :first_mentioned_in_commit_at, :first_associated_with_milestone_at, :first_added_to_board_at],
+ {
+ name: 'index_issue_metrics_on_issue_id_and_timestamps'
+ }
+ ]
+ end
+end
diff --git a/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb b/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb
new file mode 100644
index 00000000000..e7ffd7cd4d3
--- /dev/null
+++ b/db/migrate/20190905140605_add_cloud_run_to_clusters_providers_gcp.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddCloudRunToClustersProvidersGcp < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_column_with_default(:cluster_providers_gcp, :cloud_run, :boolean, default: false)
+ end
+
+ def down
+ remove_column(:cluster_providers_gcp, :cloud_run)
+ end
+end
diff --git a/db/migrate/20190909045845_create_project_pages_metadata.rb b/db/migrate/20190909045845_create_project_pages_metadata.rb
new file mode 100644
index 00000000000..5fc8fc6e6c1
--- /dev/null
+++ b/db/migrate/20190909045845_create_project_pages_metadata.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateProjectPagesMetadata < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ create_table :project_pages_metadata, id: false do |t|
+ t.references :project, null: false, index: { unique: true }, foreign_key: { on_delete: :cascade }
+ t.boolean :deployed, null: false, default: false
+
+ t.index :project_id, name: 'index_project_pages_metadata_on_project_id_and_deployed_is_true', where: "deployed = TRUE"
+ end
+ end
+end
diff --git a/db/migrate/20190911115056_add_projects_max_pages_size.rb b/db/migrate/20190911115056_add_projects_max_pages_size.rb
new file mode 100644
index 00000000000..175c66953ed
--- /dev/null
+++ b/db/migrate/20190911115056_add_projects_max_pages_size.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddProjectsMaxPagesSize < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :projects, :max_pages_size, :integer
+ end
+end
diff --git a/db/migrate/20190911115109_add_namespaces_max_pages_size.rb b/db/migrate/20190911115109_add_namespaces_max_pages_size.rb
new file mode 100644
index 00000000000..c14dfa74a5a
--- /dev/null
+++ b/db/migrate/20190911115109_add_namespaces_max_pages_size.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddNamespacesMaxPagesSize < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :namespaces, :max_pages_size, :integer
+ end
+end
diff --git a/db/migrate/20190911115207_add_projects_max_artifacts_size.rb b/db/migrate/20190911115207_add_projects_max_artifacts_size.rb
new file mode 100644
index 00000000000..41cab7e5282
--- /dev/null
+++ b/db/migrate/20190911115207_add_projects_max_artifacts_size.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddProjectsMaxArtifactsSize < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :projects, :max_artifacts_size, :integer
+ end
+end
diff --git a/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb b/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb
new file mode 100644
index 00000000000..60c594c47a6
--- /dev/null
+++ b/db/migrate/20190911115222_add_namespaces_max_artifacts_size.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddNamespacesMaxArtifactsSize < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :namespaces, :max_artifacts_size, :integer
+ end
+end
diff --git a/db/migrate/20190912223232_add_role_to_users.rb b/db/migrate/20190912223232_add_role_to_users.rb
new file mode 100644
index 00000000000..afbd78ed509
--- /dev/null
+++ b/db/migrate/20190912223232_add_role_to_users.rb
@@ -0,0 +1,12 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddRoleToUsers < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :users, :role, :smallint
+ end
+end
diff --git a/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb b/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb
new file mode 100644
index 00000000000..66cd450895c
--- /dev/null
+++ b/db/migrate/20190913174707_add_spdx_id_to_software_licenses.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class AddSpdxIdToSoftwareLicenses < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def up
+ add_column :software_licenses, :spdx_identifier, :string, limit: 255
+ end
+
+ def down
+ remove_column :software_licenses, :spdx_identifier
+ end
+end
diff --git a/db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb b/db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb
new file mode 100644
index 00000000000..94f8738b0cc
--- /dev/null
+++ b/db/migrate/20190913175827_add_index_to_software_licenses_on_spdx_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToSoftwareLicensesOnSpdxId < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :software_licenses, :spdx_identifier
+ end
+
+ def down
+ remove_concurrent_index :software_licenses, :spdx_identifier
+ end
+end
diff --git a/db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb b/db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb
new file mode 100644
index 00000000000..3daca8a8e97
--- /dev/null
+++ b/db/migrate/20190918025618_add_user_and_timestamps_to_design_management_versions.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+class AddUserAndTimestampsToDesignManagementVersions < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ add_column :design_management_versions, :user_id, :integer
+ add_column :design_management_versions, :created_at, :datetime_with_timezone
+ end
+
+ def down
+ remove_columns :design_management_versions, :user_id, :created_at
+ end
+end
diff --git a/db/migrate/20190918102042_create_grafana_integrations.rb b/db/migrate/20190918102042_create_grafana_integrations.rb
new file mode 100644
index 00000000000..aac27d129db
--- /dev/null
+++ b/db/migrate/20190918102042_create_grafana_integrations.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class CreateGrafanaIntegrations < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ create_table :grafana_integrations do |t|
+ t.references :project, index: true, foreign_key: { on_delete: :cascade }, unique: true, null: false
+ t.timestamps_with_timezone null: false
+ t.string :encrypted_token, limit: 255, null: false
+ t.string :encrypted_token_iv, limit: 255, null: false
+ t.string :grafana_url, null: false, limit: 1024
+ end
+ end
+end
diff --git a/db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb b/db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb
new file mode 100644
index 00000000000..d736b21dddf
--- /dev/null
+++ b/db/migrate/20190919040324_add_successfull_pages_deploy_partial_index_on_ci_builds.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+class AddSuccessfullPagesDeployPartialIndexOnCiBuilds < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_builds_on_project_id_for_successfull_pages_deploy'
+
+ def up
+ add_concurrent_index(
+ :ci_builds, :project_id,
+ name: INDEX_NAME,
+ where: "type='GenericCommitStatus' AND stage='deploy' AND name='pages:deploy' AND status = 'success'"
+ )
+ end
+
+ def down
+ remove_concurrent_index_by_name :ci_builds, INDEX_NAME
+ end
+end
diff --git a/db/migrate/20190919091300_create_evidences.rb b/db/migrate/20190919091300_create_evidences.rb
new file mode 100644
index 00000000000..3f861ed26bd
--- /dev/null
+++ b/db/migrate/20190919091300_create_evidences.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class CreateEvidences < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ create_table :evidences do |t|
+ t.references :release, foreign_key: { on_delete: :cascade }, null: false
+ t.timestamps_with_timezone
+ t.binary :summary_sha
+ t.jsonb :summary, null: false, default: {}
+ end
+ end
+end
diff --git a/db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb b/db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb
new file mode 100644
index 00000000000..5e0d80630cd
--- /dev/null
+++ b/db/migrate/20190919104119_index_timestamp_columns_for_merge_requests_creation_date.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class IndexTimestampColumnsForMergeRequestsCreationDate < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(*index_arguments)
+ end
+
+ def down
+ remove_concurrent_index(*index_arguments)
+ end
+
+ private
+
+ def index_arguments
+ [
+ :merge_requests,
+ [:target_project_id, :created_at],
+ {
+ name: 'index_merge_requests_target_project_id_created_at'
+ }
+ ]
+ end
+end
diff --git a/db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb b/db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb
new file mode 100644
index 00000000000..8e0bde97cc1
--- /dev/null
+++ b/db/migrate/20190919162036_add_index_to_clusters_providers_gcp_on_cloud_run.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToClustersProvidersGcpOnCloudRun < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:cluster_providers_gcp, :cloud_run)
+ end
+
+ def down
+ remove_concurrent_index(:cluster_providers_gcp, :cloud_run)
+ end
+end
diff --git a/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb b/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb
new file mode 100644
index 00000000000..d359350a891
--- /dev/null
+++ b/db/migrate/20190919183411_add_index_packages_on_name_trigram_to_packages_packages.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexPackagesOnNameTrigramToPackagesPackages < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_packages_packages_on_name_trigram'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :packages_packages, :name, name: INDEX_NAME, using: :gin, opclass: { name: :gin_trgm_ops }
+ end
+
+ def down
+ remove_concurrent_index_by_name(:packages_packages, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb b/db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb
new file mode 100644
index 00000000000..f8f1c6c231b
--- /dev/null
+++ b/db/migrate/20190920194925_backfill_releases_table_updated_at_and_add_not_null_constraints_to_timestamps.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+class BackfillReleasesTableUpdatedAtAndAddNotNullConstraintsToTimestamps < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ change_column_null(:releases, :created_at, false, Time.zone.now)
+
+ update_column_in_batches(:releases, :updated_at, Arel.sql('created_at')) do |table, query|
+ query.where(table[:updated_at].eq(nil))
+ end
+
+ change_column_null(:releases, :updated_at, false, Time.zone.now)
+ end
+
+ def down
+ change_column_null(:releases, :updated_at, true)
+ change_column_null(:releases, :created_at, true)
+ end
+end
diff --git a/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb b/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb
new file mode 100644
index 00000000000..b9f729d7d66
--- /dev/null
+++ b/db/migrate/20190924124627_add_pull_mirror_branch_prefix_to_projects.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddPullMirrorBranchPrefixToProjects < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :projects, :pull_mirror_branch_prefix, :string, limit: 50
+ end
+end
diff --git a/db/migrate/20190925055714_default_request_access_groups.rb b/db/migrate/20190925055714_default_request_access_groups.rb
new file mode 100644
index 00000000000..ba3efbe56f4
--- /dev/null
+++ b/db/migrate/20190925055714_default_request_access_groups.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class DefaultRequestAccessGroups < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ change_column_default :namespaces, :request_access_enabled, true
+ end
+
+ def down
+ change_column_default :namespaces, :request_access_enabled, false
+ end
+end
diff --git a/db/migrate/20190925055902_default_request_access_projects.rb b/db/migrate/20190925055902_default_request_access_projects.rb
new file mode 100644
index 00000000000..3ad88d0963d
--- /dev/null
+++ b/db/migrate/20190925055902_default_request_access_projects.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+class DefaultRequestAccessProjects < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ change_column_default :projects, :request_access_enabled, true
+ end
+
+ def down
+ change_column_default :projects, :request_access_enabled, false
+ end
+end
diff --git a/db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb b/db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb
new file mode 100644
index 00000000000..6eb9fdbbcaa
--- /dev/null
+++ b/db/migrate/20190926041216_add_user_indexes_to_design_management_versions.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddUserIndexesToDesignManagementVersions < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :design_management_versions, :users, column: :user_id, on_delete: :nullify
+ add_concurrent_index :design_management_versions, :user_id, where: 'user_id IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index :design_management_versions, :user_id
+ remove_foreign_key :design_management_versions, column: :user_id
+ end
+end
diff --git a/db/migrate/20190927055500_create_description_versions.rb b/db/migrate/20190927055500_create_description_versions.rb
new file mode 100644
index 00000000000..6ad34d4a89e
--- /dev/null
+++ b/db/migrate/20190927055500_create_description_versions.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+class CreateDescriptionVersions < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ create_table :description_versions do |t|
+ t.timestamps_with_timezone
+ t.references :issue, index: false, foreign_key: { on_delete: :cascade }, type: :integer
+ t.references :merge_request, index: false, foreign_key: { on_delete: :cascade }, type: :integer
+ t.references :epic, index: false, foreign_key: { on_delete: :cascade }, type: :integer
+ t.text :description
+ end
+
+ add_index :description_versions, :issue_id, where: 'issue_id IS NOT NULL'
+ add_index :description_versions, :merge_request_id, where: 'merge_request_id IS NOT NULL'
+ add_index :description_versions, :epic_id, where: 'epic_id IS NOT NULL'
+
+ add_column :system_note_metadata, :description_version_id, :bigint
+ end
+
+ def down
+ remove_column :system_note_metadata, :description_version_id
+
+ drop_table :description_versions
+ end
+end
diff --git a/db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb b/db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb
new file mode 100644
index 00000000000..695ba955043
--- /dev/null
+++ b/db/migrate/20190927055540_add_index_to_sytem_note_metadata_description_version_id.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexToSytemNoteMetadataDescriptionVersionId < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :system_note_metadata, :description_version_id, unique: true, where: 'description_version_id IS NOT NULL'
+ add_concurrent_foreign_key :system_note_metadata, :description_versions, column: :description_version_id, on_delete: :nullify
+ end
+
+ def down
+ remove_foreign_key :system_note_metadata, column: :description_version_id
+ remove_concurrent_index :system_note_metadata, :description_version_id
+ end
+end
diff --git a/db/migrate/20190927074328_add_index_on_snippet_content.rb b/db/migrate/20190927074328_add_index_on_snippet_content.rb
new file mode 100644
index 00000000000..ef7583508f2
--- /dev/null
+++ b/db/migrate/20190927074328_add_index_on_snippet_content.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class AddIndexOnSnippetContent < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ INDEX_NAME = 'index_snippets_on_content_trigram'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :snippets, :content, name: INDEX_NAME, using: :gin, opclass: { content: :gin_trgm_ops }
+ end
+
+ def down
+ remove_concurrent_index_by_name(:snippets, INDEX_NAME)
+ end
+end
diff --git a/db/migrate/20190929180751_create_vulnerabilities.rb b/db/migrate/20190929180751_create_vulnerabilities.rb
new file mode 100644
index 00000000000..aea018c5979
--- /dev/null
+++ b/db/migrate/20190929180751_create_vulnerabilities.rb
@@ -0,0 +1,39 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class CreateVulnerabilities < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :vulnerabilities do |t|
+ t.bigint "milestone_id"
+ t.bigint "epic_id"
+ t.bigint "project_id", null: false
+ t.bigint "author_id", null: false
+ t.bigint "updated_by_id"
+ t.bigint "last_edited_by_id"
+ t.bigint "start_date_sourcing_milestone_id"
+ t.bigint "due_date_sourcing_milestone_id"
+ t.bigint "closed_by_id"
+ t.datetime_with_timezone "last_edited_at"
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.datetime_with_timezone "closed_at"
+ t.date "start_date"
+ t.date "due_date"
+ t.integer "state", limit: 2, default: 1, null: false # initially: open, closed
+ t.integer "severity", limit: 2, null: false # auto-calculated as highest-severity finding, but overrideable
+ t.integer "confidence", limit: 2, null: false # auto-calculated as lowest-confidence finding, but overrideable
+ t.boolean "severity_overridden", default: false
+ t.boolean "confidence_overridden", default: false
+ t.string "title", limit: 255, null: false
+ t.text "title_html", null: false
+ t.text "description"
+ t.text "description_html"
+ end
+ end
+end
diff --git a/db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb b/db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb
new file mode 100644
index 00000000000..eb8e8fb73d1
--- /dev/null
+++ b/db/migrate/20190929180813_add_reference_from_vulnerability_occurrences_to_occurrences.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddReferenceFromVulnerabilityOccurrencesToOccurrences < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ add_column :vulnerability_occurrences, :vulnerability_id, :bigint
+ end
+end
diff --git a/db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb b/db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb
new file mode 100644
index 00000000000..4d7c2363083
--- /dev/null
+++ b/db/migrate/20190929180827_add_foreign_keys_and_indexes_to_vulnerabilities.rb
@@ -0,0 +1,76 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddForeignKeysAndIndexesToVulnerabilities < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :vulnerabilities, :milestone_id
+ add_concurrent_foreign_key :vulnerabilities, :milestones, column: :milestone_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :epic_id
+ add_concurrent_foreign_key :vulnerabilities, :epics, column: :epic_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :project_id
+ add_concurrent_foreign_key :vulnerabilities, :projects, column: :project_id
+
+ add_concurrent_index :vulnerabilities, :author_id
+ add_concurrent_foreign_key :vulnerabilities, :users, column: :author_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :updated_by_id
+ add_concurrent_foreign_key :vulnerabilities, :users, column: :updated_by_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :last_edited_by_id
+ add_concurrent_foreign_key :vulnerabilities, :users, column: :last_edited_by_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :closed_by_id
+ add_concurrent_foreign_key :vulnerabilities, :users, column: :closed_by_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :start_date_sourcing_milestone_id
+ add_concurrent_foreign_key :vulnerabilities, :milestones, column: :start_date_sourcing_milestone_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerabilities, :due_date_sourcing_milestone_id
+ add_concurrent_foreign_key :vulnerabilities, :milestones, column: :due_date_sourcing_milestone_id, on_delete: :nullify
+
+ add_concurrent_index :vulnerability_occurrences, :vulnerability_id
+ add_concurrent_foreign_key :vulnerability_occurrences, :vulnerabilities, column: :vulnerability_id, on_delete: :nullify
+ end
+
+ def down
+ remove_foreign_key :vulnerability_occurrences, :vulnerabilities
+ remove_concurrent_index :vulnerability_occurrences, :vulnerability_id
+
+ remove_foreign_key :vulnerabilities, column: :due_date_sourcing_milestone_id
+ remove_concurrent_index :vulnerabilities, :due_date_sourcing_milestone_id
+
+ remove_foreign_key :vulnerabilities, column: :start_date_sourcing_milestone_id
+ remove_concurrent_index :vulnerabilities, :start_date_sourcing_milestone_id
+
+ remove_foreign_key :vulnerabilities, column: :closed_by_id
+ remove_concurrent_index :vulnerabilities, :closed_by_id
+
+ remove_foreign_key :vulnerabilities, column: :last_edited_by_id
+ remove_concurrent_index :vulnerabilities, :last_edited_by_id
+
+ remove_foreign_key :vulnerabilities, column: :updated_by_id
+ remove_concurrent_index :vulnerabilities, :updated_by_id
+
+ remove_foreign_key :vulnerabilities, column: :author_id
+ remove_concurrent_index :vulnerabilities, :author_id
+
+ remove_foreign_key :vulnerabilities, :projects
+ remove_concurrent_index :vulnerabilities, :project_id
+
+ remove_foreign_key :vulnerabilities, :epics
+ remove_concurrent_index :vulnerabilities, :epic_id
+
+ remove_foreign_key :vulnerabilities, :milestones
+ remove_concurrent_index :vulnerabilities, :milestone_id
+ end
+end
diff --git a/db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb b/db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb
new file mode 100644
index 00000000000..577c705fbef
--- /dev/null
+++ b/db/migrate/20190930025655_add_incident_management_throttle_columns_to_application_setting.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class AddIncidentManagementThrottleColumnsToApplicationSetting < ActiveRecord::Migration[5.2]
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def up
+ add_column(:application_settings,
+ :throttle_incident_management_notification_enabled,
+ :boolean,
+ null: false,
+ default: false)
+
+ add_column(:application_settings,
+ :throttle_incident_management_notification_period_in_seconds,
+ :integer,
+ default: 3_600)
+
+ add_column(:application_settings,
+ :throttle_incident_management_notification_per_period,
+ :integer,
+ default: 3_600)
+ end
+
+ def down
+ remove_column :application_settings, :throttle_incident_management_notification_enabled
+ remove_column :application_settings, :throttle_incident_management_notification_period_in_seconds
+ remove_column :application_settings, :throttle_incident_management_notification_per_period
+ end
+end
diff --git a/db/migrate/20190930063627_add_management_project_id_to_clusters.rb b/db/migrate/20190930063627_add_management_project_id_to_clusters.rb
new file mode 100644
index 00000000000..46c3fef8e76
--- /dev/null
+++ b/db/migrate/20190930063627_add_management_project_id_to_clusters.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddManagementProjectIdToClusters < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :clusters, :management_project_id, :integer
+ end
+end
diff --git a/db/migrate/20190930082942_add_new_release_to_notification_settings.rb b/db/migrate/20190930082942_add_new_release_to_notification_settings.rb
new file mode 100644
index 00000000000..2ec5815f542
--- /dev/null
+++ b/db/migrate/20190930082942_add_new_release_to_notification_settings.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+class AddNewReleaseToNotificationSettings < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :notification_settings, :new_release, :boolean
+ end
+end
diff --git a/db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb b/db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb
new file mode 100644
index 00000000000..97253dd1f2d
--- /dev/null
+++ b/db/migrate/20191001040549_add_management_project_id_index_fk_to_clusters.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddManagementProjectIdIndexFkToClusters < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_foreign_key :clusters, :projects, column: :management_project_id, on_delete: :nullify
+ add_concurrent_index :clusters, :management_project_id, where: 'management_project_id IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index :clusters, :management_project_id
+ remove_foreign_key_if_exists :clusters, column: :management_project_id
+ end
+end
diff --git a/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb b/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb
new file mode 100644
index 00000000000..94d16e921df
--- /dev/null
+++ b/db/migrate/20191003015155_add_self_managed_prometheus_alerts.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddSelfManagedPrometheusAlerts < ActiveRecord::Migration[5.2]
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def change
+ create_table :self_managed_prometheus_alert_events do |t|
+ t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false
+ t.references :environment, index: true, foreign_key: { on_delete: :cascade }
+ t.datetime_with_timezone :started_at, null: false
+ t.datetime_with_timezone :ended_at
+
+ t.integer :status, null: false, limit: 2
+ t.string :title, null: false, limit: 255
+ t.string :query_expression, limit: 255
+ t.string :payload_key, null: false, limit: 255
+ t.index [:project_id, :payload_key], unique: true, name: 'idx_project_id_payload_key_self_managed_prometheus_alert_events'
+ end
+ end
+end
diff --git a/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb b/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb
new file mode 100644
index 00000000000..f107181bbde
--- /dev/null
+++ b/db/migrate/20191003060227_add_push_event_hooks_limit_to_application_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPushEventHooksLimitToApplicationSettings < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_column_with_default(:application_settings, :push_event_hooks_limit, :integer, default: 3)
+ end
+
+ def down
+ remove_column(:application_settings, :push_event_hooks_limit)
+ end
+end
diff --git a/db/migrate/20191003064615_create_aws_roles.rb b/db/migrate/20191003064615_create_aws_roles.rb
new file mode 100644
index 00000000000..ee35953f558
--- /dev/null
+++ b/db/migrate/20191003064615_create_aws_roles.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class CreateAwsRoles < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ create_table :aws_roles, id: false do |t|
+ t.references :user, primary_key: true, default: nil, type: :integer, index: { unique: true }, foreign_key: { on_delete: :cascade }
+
+ t.timestamps_with_timezone null: false
+
+ t.string :role_arn, null: false, limit: 2048
+ t.string :role_external_id, null: false, limit: 64
+
+ t.index :role_external_id, unique: true
+ end
+ end
+end
diff --git a/db/migrate/20191004133612_create_analytics_repository_file_commits.rb b/db/migrate/20191004133612_create_analytics_repository_file_commits.rb
new file mode 100644
index 00000000000..f2064b2b301
--- /dev/null
+++ b/db/migrate/20191004133612_create_analytics_repository_file_commits.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class CreateAnalyticsRepositoryFileCommits < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ create_table :analytics_repository_file_commits do |t|
+ t.references :analytics_repository_file, index: { name: 'index_analytics_repository_file_commits_file_id' }, foreign_key: { on_delete: :cascade }, null: false
+ t.references :project, index: false, foreign_key: { on_delete: :cascade }, null: false
+ t.date :committed_date, null: false
+ t.integer :commit_count, limit: 2, null: false
+ end
+
+ add_index :analytics_repository_file_commits,
+ [:project_id, :committed_date, :analytics_repository_file_id],
+ name: 'index_file_commits_on_committed_date_file_id_and_project_id',
+ unique: true
+ end
+end
diff --git a/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb b/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb
new file mode 100644
index 00000000000..84befc95d00
--- /dev/null
+++ b/db/migrate/20191008013056_add_push_event_activities_limit_to_application_settings.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddPushEventActivitiesLimitToApplicationSettings < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_column_with_default(:application_settings, :push_event_activities_limit, :integer, default: 3)
+ end
+
+ def down
+ remove_column(:application_settings, :push_event_activities_limit)
+ end
+end
diff --git a/db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb b/db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb
new file mode 100644
index 00000000000..72621971dbb
--- /dev/null
+++ b/db/migrate/20191008142331_add_ref_count_to_push_event_payloads.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddRefCountToPushEventPayloads < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ add_column :push_event_payloads, :ref_count, :integer
+ end
+end
diff --git a/db/migrate/20191008180203_add_issuable_state_id_indexes.rb b/db/migrate/20191008180203_add_issuable_state_id_indexes.rb
new file mode 100644
index 00000000000..a9a8b8b6359
--- /dev/null
+++ b/db/migrate/20191008180203_add_issuable_state_id_indexes.rb
@@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+class AddIssuableStateIdIndexes < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ # Creates the same indexes that are currently using state:string column
+ # for issues and merge_requests tables
+ create_indexes_for_issues
+ create_indexes_for_merge_requests
+ end
+
+ def down
+ # Removes indexes for issues
+ remove_concurrent_index_by_name :issues, 'idx_issues_on_state_id'
+ remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_created_at_and_id_and_state_id'
+ remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_due_date_and_id_and_state_id'
+ remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_rel_position_and_state_id_and_id'
+ remove_concurrent_index_by_name :issues, 'idx_issues_on_project_id_and_updated_at_and_id_and_state_id'
+
+ # Removes indexes from merge_requests
+ remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_id_and_merge_jid'
+ remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_source_project_and_branch_state_opened'
+ remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_state_id_and_merge_status'
+ remove_concurrent_index_by_name :merge_requests, 'idx_merge_requests_on_target_project_id_and_iid_opened'
+ end
+
+ def create_indexes_for_issues
+ add_concurrent_index :issues, :state_id, name: 'idx_issues_on_state_id'
+
+ add_concurrent_index :issues,
+ [:project_id, :created_at, :id, :state_id],
+ name: 'idx_issues_on_project_id_and_created_at_and_id_and_state_id'
+
+ add_concurrent_index :issues,
+ [:project_id, :due_date, :id, :state_id],
+ where: 'due_date IS NOT NULL',
+ name: 'idx_issues_on_project_id_and_due_date_and_id_and_state_id'
+
+ add_concurrent_index :issues,
+ [:project_id, :relative_position, :state_id, :id],
+ order: { id: :desc },
+ name: 'idx_issues_on_project_id_and_rel_position_and_state_id_and_id'
+
+ add_concurrent_index :issues,
+ [:project_id, :updated_at, :id, :state_id],
+ name: 'idx_issues_on_project_id_and_updated_at_and_id_and_state_id'
+ end
+
+ def create_indexes_for_merge_requests
+ add_concurrent_index :merge_requests,
+ [:id, :merge_jid],
+ where: 'merge_jid IS NOT NULL and state_id = 4',
+ name: 'idx_merge_requests_on_id_and_merge_jid'
+
+ add_concurrent_index :merge_requests,
+ [:source_project_id, :source_branch],
+ where: 'state_id = 1',
+ name: 'idx_merge_requests_on_source_project_and_branch_state_opened'
+
+ add_concurrent_index :merge_requests,
+ [:state_id, :merge_status],
+ where: "state_id = 1 AND merge_status = 'can_be_merged'",
+ name: 'idx_merge_requests_on_state_id_and_merge_status'
+
+ add_concurrent_index :merge_requests,
+ [:target_project_id, :iid],
+ where: 'state_id = 1',
+ name: 'idx_merge_requests_on_target_project_id_and_iid_opened'
+ end
+end
diff --git a/db/migrate/20191008200204_add_state_id_default_value.rb b/db/migrate/20191008200204_add_state_id_default_value.rb
new file mode 100644
index 00000000000..15a80163ca8
--- /dev/null
+++ b/db/migrate/20191008200204_add_state_id_default_value.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddStateIdDefaultValue < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ change_column_default :issues, :state_id, 1
+ change_column_null :issues, :state_id, false
+ change_column_default :merge_requests, :state_id, 1
+ change_column_null :merge_requests, :state_id, false
+ end
+
+ def down
+ change_column_default :issues, :state_id, nil
+ change_column_null :issues, :state_id, true
+ change_column_default :merge_requests, :state_id, nil
+ change_column_null :merge_requests, :state_id, true
+ end
+end
diff --git a/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb b/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb
new file mode 100644
index 00000000000..0fa8ff449f7
--- /dev/null
+++ b/db/migrate/20191009222222_add_custom_http_clone_url_root_to_application_settings.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class AddCustomHttpCloneUrlRootToApplicationSettings < ActiveRecord::Migration[5.2]
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def change
+ add_column :application_settings, :custom_http_clone_url_root, :string, limit: 511
+ end
+end
diff --git a/db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb b/db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb
new file mode 100644
index 00000000000..a8f40953e5d
--- /dev/null
+++ b/db/migrate/20191014084150_add_index_on_snippets_project_id_and_visibility_level.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexOnSnippetsProjectIdAndVisibilityLevel < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :snippets, [:project_id, :visibility_level]
+ end
+
+ def down
+ remove_concurrent_index :snippets, [:project_id, :visibility_level]
+ end
+end
diff --git a/db/migrate/20191014132931_remove_index_on_snippets_project_id.rb b/db/migrate/20191014132931_remove_index_on_snippets_project_id.rb
new file mode 100644
index 00000000000..a1d3ffdb8c8
--- /dev/null
+++ b/db/migrate/20191014132931_remove_index_on_snippets_project_id.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class RemoveIndexOnSnippetsProjectId < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ remove_concurrent_index :snippets, [:project_id]
+ end
+
+ def down
+ add_concurrent_index :snippets, [:project_id]
+ end
+end
diff --git a/db/migrate/20191016072826_replace_ci_trigger_requests_index.rb b/db/migrate/20191016072826_replace_ci_trigger_requests_index.rb
new file mode 100644
index 00000000000..d7c9524806e
--- /dev/null
+++ b/db/migrate/20191016072826_replace_ci_trigger_requests_index.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class ReplaceCiTriggerRequestsIndex < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_trigger_requests, [:trigger_id, :id], order: { id: :desc }
+
+ remove_concurrent_index :ci_trigger_requests, [:trigger_id]
+ end
+
+ def down
+ add_concurrent_index :ci_trigger_requests, [:trigger_id]
+
+ remove_concurrent_index :ci_trigger_requests, [:trigger_id, :id], order: { id: :desc }
+ end
+end
diff --git a/db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb b/db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb
new file mode 100644
index 00000000000..68b448f8836
--- /dev/null
+++ b/db/migrate/20191016220135_add_join_table_for_self_managed_prometheus_alert_issues.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+class AddJoinTableForSelfManagedPrometheusAlertIssues < ActiveRecord::Migration[5.2]
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def change
+ # Join table to Issues
+ create_table :issues_self_managed_prometheus_alert_events, id: false do |t|
+ t.references :issue, null: false,
+ index: false, # Uses the index below
+ foreign_key: { on_delete: :cascade }
+ t.references :self_managed_prometheus_alert_event, null: false,
+ index: { name: 'issue_id_issues_self_managed_rometheus_alert_events_index' },
+ foreign_key: { on_delete: :cascade }
+
+ t.timestamps_with_timezone
+ t.index [:issue_id, :self_managed_prometheus_alert_event_id],
+ unique: true, name: 'issue_id_self_managed_prometheus_alert_event_id_index'
+ end
+ end
+end
diff --git a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
index 53918250b4c..d44ec1036c4 100644
--- a/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
+++ b/db/post_migrate/20180306164012_add_path_index_to_redirect_routes.rb
@@ -14,9 +14,7 @@ class AddPathIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
# RedirectRoute.matching_path_and_descendants
#
# This same index is also added in the `ReworkRedirectRoutesIndexes` so this
- # is a no-op in most cases. But this migration is also called from the
- # `setup_postgresql.rake` task when setting up a new database, in which case
- # we want to create the index.
+ # is a no-op in most cases.
def up
return unless Gitlab::Database.postgresql?
@@ -31,8 +29,5 @@ class AddPathIndexToRedirectRoutes < ActiveRecord::Migration[4.2]
# Do nothing in the DOWN. Since the index above is originally created in the
# `ReworkRedirectRoutesIndexes`. This migration wouldn't have actually
# created any new index.
- #
- # This migration is only here to be called form `setup_postgresql.rake` so
- # any newly created database would have this index.
end
end
diff --git a/db/post_migrate/20190819231552_update_knative_prometheus_query_for_invocation_count.rb b/db/post_migrate/20190819231552_update_knative_prometheus_query_for_invocation_count.rb
new file mode 100644
index 00000000000..828f551baf6
--- /dev/null
+++ b/db/post_migrate/20190819231552_update_knative_prometheus_query_for_invocation_count.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class UpdateKnativePrometheusQueryForInvocationCount < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def up
+ ::Gitlab::DatabaseImporters::CommonMetrics::Importer.new.execute
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20190827102026_migrate_code_owner_approval_status_to_protected_branches_in_batches.rb b/db/post_migrate/20190827102026_migrate_code_owner_approval_status_to_protected_branches_in_batches.rb
new file mode 100644
index 00000000000..b109f582909
--- /dev/null
+++ b/db/post_migrate/20190827102026_migrate_code_owner_approval_status_to_protected_branches_in_batches.rb
@@ -0,0 +1,46 @@
+# frozen_string_literal: true
+
+class MigrateCodeOwnerApprovalStatusToProtectedBranchesInBatches < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+ BATCH_SIZE = 200
+
+ class Project < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'projects'
+ self.inheritance_column = :_type_disabled
+
+ has_many :protected_branches
+ end
+
+ class ProtectedBranch < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'protected_branches'
+ self.inheritance_column = :_type_disabled
+
+ belongs_to :project
+ end
+
+ def up
+ add_concurrent_index :projects, :id, name: "temp_active_projects_with_prot_branches", where: 'archived = false and pending_delete = false and merge_requests_require_code_owner_approval = true'
+
+ ProtectedBranch
+ .joins(:project)
+ .where(projects: { archived: false, pending_delete: false, merge_requests_require_code_owner_approval: true })
+ .each_batch(of: BATCH_SIZE) do |batch|
+ batch.update_all(code_owner_approval_required: true)
+ end
+
+ remove_concurrent_index_by_name(:projects, "temp_active_projects_with_prot_branches")
+ end
+
+ def down
+ # noop
+ #
+ end
+end
diff --git a/db/post_migrate/20190905091812_schedule_project_any_approval_rule_migration.rb b/db/post_migrate/20190905091812_schedule_project_any_approval_rule_migration.rb
index ef1cb452c26..be47e4dfdf5 100644
--- a/db/post_migrate/20190905091812_schedule_project_any_approval_rule_migration.rb
+++ b/db/post_migrate/20190905091812_schedule_project_any_approval_rule_migration.rb
@@ -22,6 +22,8 @@ class ScheduleProjectAnyApprovalRuleMigration < ActiveRecord::Migration[5.2]
end
def up
+ return unless Gitlab.ee?
+
add_concurrent_index :projects, :id,
name: 'tmp_projects_with_approvals_before_merge',
where: 'approvals_before_merge <> 0'
diff --git a/db/post_migrate/20190905091831_schedule_merge_request_any_approval_rule_migration.rb b/db/post_migrate/20190905091831_schedule_merge_request_any_approval_rule_migration.rb
index 4a8398a9eea..cdec87270f0 100644
--- a/db/post_migrate/20190905091831_schedule_merge_request_any_approval_rule_migration.rb
+++ b/db/post_migrate/20190905091831_schedule_merge_request_any_approval_rule_migration.rb
@@ -22,6 +22,8 @@ class ScheduleMergeRequestAnyApprovalRuleMigration < ActiveRecord::Migration[5.2
end
def up
+ return unless Gitlab.ee?
+
add_concurrent_index :merge_requests, :id,
name: 'tmp_merge_requests_with_approvals_before_merge',
where: 'approvals_before_merge <> 0'
diff --git a/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb b/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb
new file mode 100644
index 00000000000..befa08e0cb6
--- /dev/null
+++ b/db/post_migrate/20190909141517_update_cs_vulnerability_confidence_column.rb
@@ -0,0 +1,32 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+class UpdateCsVulnerabilityConfidenceColumn < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ disable_ddl_transaction!
+
+ DOWNTIME = false
+ BATCH_SIZE = 1_000
+ INTERVAL = 5.minutes
+
+ # 137_424 records to be updated on GitLab.com,
+ # giving us an estimated runtime of 12 hours.
+ def up
+ # no-op in CE
+ return unless Gitlab.ee?
+
+ migration = Gitlab::BackgroundMigration::UpdateVulnerabilityConfidence
+ migration_name = migration.to_s.demodulize
+ relation = migration::Occurrence.container_scanning_reports_with_medium_confidence
+ queue_background_migration_jobs_by_range_at_intervals(relation,
+ migration_name,
+ INTERVAL,
+ batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20190911251732_sync_issuables_state_id.rb b/db/post_migrate/20190911251732_sync_issuables_state_id.rb
new file mode 100644
index 00000000000..4865e98a75e
--- /dev/null
+++ b/db/post_migrate/20190911251732_sync_issuables_state_id.rb
@@ -0,0 +1,79 @@
+# frozen_string_literal: true
+
+# Sync remaining records for issues/merge_requests tables where state_id
+# is still null.
+# For more information check: https://gitlab.com/gitlab-org/gitlab/issues/26823
+# It creates a temporary index before performing the UPDATES to sync values.
+#
+# In 09-11-2019 we have the following numbers for records with state_id == nil:
+#
+# 1348 issues - default batch size for each update 67
+# 10247 merge requests - default batch size for each update 511
+
+class SyncIssuablesStateId < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ %i(issues merge_requests).each do |table|
+ temp_index_name = index_name_for(table)
+
+ add_concurrent_index(
+ table,
+ 'id',
+ name: temp_index_name,
+ where: 'state_id IS NULL'
+ )
+
+ update_value = update_condition_for(table)
+
+ update_column_in_batches(table, :state_id, update_value) do |table, query|
+ query.where(table[:state_id].eq(nil))
+ end
+ ensure
+ remove_concurrent_index_by_name(table, temp_index_name)
+ end
+ end
+
+ def down
+ # NO OP
+ end
+
+ def update_condition_for(table)
+ value_expresson =
+ if table == :issues
+ issues_state_id_condition
+ else
+ merge_requests_state_id_condition
+ end
+
+ Arel.sql(value_expresson)
+ end
+
+ def index_name_for(table)
+ "idx_tmp_on_#{table}_where_state_id_is_null"
+ end
+
+ def issues_state_id_condition
+ <<~SQL
+ CASE state
+ WHEN 'opened' THEN 1
+ WHEN 'closed' THEN 2
+ END
+ SQL
+ end
+
+ def merge_requests_state_id_condition
+ <<~SQL
+ CASE state
+ WHEN 'opened' THEN 1
+ WHEN 'closed' THEN 2
+ WHEN 'merged' THEN 3
+ WHEN 'locked' THEN 4
+ END
+ SQL
+ end
+end
diff --git a/db/post_migrate/20190917173107_backfill_software_licenses_spdx_identifiers.rb b/db/post_migrate/20190917173107_backfill_software_licenses_spdx_identifiers.rb
new file mode 100644
index 00000000000..09492f5f99e
--- /dev/null
+++ b/db/post_migrate/20190917173107_backfill_software_licenses_spdx_identifiers.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+class BackfillSoftwareLicensesSpdxIdentifiers < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ CURRENT_LICENSES = {
+ 'AGPL-1.0' => 'AGPL-1.0',
+ 'AGPL-3.0' => 'AGPL-3.0',
+ 'Apache 2.0' => 'Apache-2.0',
+ 'Artistic-2.0' => 'Artistic-2.0',
+ 'BSD' => 'BSD-4-Clause',
+ 'CC0 1.0 Universal' => 'CC0-1.0',
+ 'CDDL-1.0' => 'CDDL-1.0',
+ 'CDDL-1.1' => 'CDDL-1.1',
+ 'EPL-1.0' => 'EPL-1.0',
+ 'EPL-2.0' => 'EPL-2.0',
+ 'GPLv2' => 'GPL-2.0',
+ 'GPLv3' => 'GPL-3.0',
+ 'ISC' => 'ISC',
+ 'LGPL' => 'LGPL-3.0-only',
+ 'LGPL-2.1' => 'LGPL-2.1',
+ 'MIT' => 'MIT',
+ 'Mozilla Public License 2.0' => 'MPL-2.0',
+ 'MS-PL' => 'MS-PL',
+ 'MS-RL' => 'MS-RL',
+ 'New BSD' => 'BSD-3-Clause',
+ 'Python Software Foundation License' => 'Python-2.0',
+ 'ruby' => 'Ruby',
+ 'Simplified BSD' => 'BSD-2-Clause',
+ 'WTFPL' => 'WTFPL',
+ 'Zlib' => 'Zlib'
+ }.freeze
+
+ disable_ddl_transaction!
+
+ # 25 records to be updated on GitLab.com
+ def up
+ return unless Gitlab.ee?
+
+ say "Expect #{CURRENT_LICENSES.count} updates to the software_licenses table to occur"
+ CURRENT_LICENSES.each do |name, spdx_identifier|
+ # The following cop is disabled because of https://gitlab.com/gitlab-org/gitlab/issues/33470
+ # For more context see https://gitlab.com/gitlab-org/gitlab/merge_requests/17004#note_226264823
+ # rubocop:disable Migration/UpdateColumnInBatches
+ update_column_in_batches(:software_licenses, :spdx_identifier, spdx_identifier) do |table, query|
+ query.where(table[:name].eq(name))
+ end
+ end
+ end
+
+ def down
+ return unless Gitlab.ee?
+
+ update_column_in_batches(:software_licenses, :spdx_identifier, nil)
+ end
+end
diff --git a/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb b/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb
new file mode 100644
index 00000000000..0cd24da50d0
--- /dev/null
+++ b/db/post_migrate/20191002031332_schedule_pages_metadata_migration.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+class SchedulePagesMetadataMigration < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ BATCH_SIZE = 10_000
+ MIGRATION = 'MigratePagesMetadata'
+
+ disable_ddl_transaction!
+
+ class Project < ActiveRecord::Base
+ include ::EachBatch
+
+ self.table_name = 'projects'
+ end
+
+ def up
+ say "Scheduling `#{MIGRATION}` jobs"
+
+ # At the time of writing there are ~10_669_292 records to be inserted for GitLab.com,
+ # batches of 10_000 with delay interval of 2 minutes gives us an estimate of close to 36 hours.
+ queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE)
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20191007163701_populate_remaining_any_approver_rules_for_merge_requests.rb b/db/post_migrate/20191007163701_populate_remaining_any_approver_rules_for_merge_requests.rb
new file mode 100644
index 00000000000..e1c0f1d6c0c
--- /dev/null
+++ b/db/post_migrate/20191007163701_populate_remaining_any_approver_rules_for_merge_requests.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class PopulateRemainingAnyApproverRulesForMergeRequests < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 10_000
+ MIGRATION = 'PopulateAnyApprovalRuleForMergeRequests'
+
+ disable_ddl_transaction!
+
+ class MergeRequest < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'merge_requests'
+
+ scope :with_approvals_before_merge, -> { where.not(approvals_before_merge: 0) }
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ add_concurrent_index :merge_requests, :id,
+ name: 'tmp_merge_requests_with_approvals_before_merge',
+ where: 'approvals_before_merge != 0'
+
+ Gitlab::BackgroundMigration.steal(MIGRATION)
+
+ PopulateRemainingAnyApproverRulesForMergeRequests::MergeRequest.with_approvals_before_merge.each_batch(of: BATCH_SIZE) do |batch|
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+
+ Gitlab::BackgroundMigration::PopulateAnyApprovalRuleForMergeRequests.new.perform(*range)
+ end
+
+ remove_concurrent_index_by_name(:merge_requests, 'tmp_merge_requests_with_approvals_before_merge')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/post_migrate/20191007163736_populate_remaining_any_approver_rules_for_projects.rb b/db/post_migrate/20191007163736_populate_remaining_any_approver_rules_for_projects.rb
new file mode 100644
index 00000000000..fce17ffcf16
--- /dev/null
+++ b/db/post_migrate/20191007163736_populate_remaining_any_approver_rules_for_projects.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class PopulateRemainingAnyApproverRulesForProjects < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ BATCH_SIZE = 5_000
+ MIGRATION = 'PopulateAnyApprovalRuleForProjects'
+
+ disable_ddl_transaction!
+
+ class Project < ActiveRecord::Base
+ include EachBatch
+
+ self.table_name = 'projects'
+
+ scope :with_approvals_before_merge, -> { where.not(approvals_before_merge: 0) }
+ end
+
+ def up
+ return unless Gitlab.ee?
+
+ add_concurrent_index :projects, :id,
+ name: 'tmp_projects_with_approvals_before_merge',
+ where: 'approvals_before_merge != 0'
+
+ Gitlab::BackgroundMigration.steal(MIGRATION)
+
+ PopulateRemainingAnyApproverRulesForProjects::Project.with_approvals_before_merge.each_batch(of: BATCH_SIZE) do |batch|
+ range = batch.pluck('MIN(id)', 'MAX(id)').first
+
+ Gitlab::BackgroundMigration::PopulateAnyApprovalRuleForProjects.new.perform(*range)
+ end
+
+ remove_concurrent_index_by_name(:projects, 'tmp_projects_with_approvals_before_merge')
+ end
+
+ def down
+ # no-op
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 09f27d2f9cb..f3a2b4608f5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2019_09_18_104222) do
+ActiveRecord::Schema.define(version: 2019_10_16_220135) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -93,6 +93,30 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["project_id"], name: "analytics_repository_languages_on_project_id"
end
+ create_table "analytics_repository_file_commits", force: :cascade do |t|
+ t.bigint "analytics_repository_file_id", null: false
+ t.bigint "project_id", null: false
+ t.date "committed_date", null: false
+ t.integer "commit_count", limit: 2, null: false
+ t.index ["analytics_repository_file_id"], name: "index_analytics_repository_file_commits_file_id"
+ t.index ["project_id", "committed_date", "analytics_repository_file_id"], name: "index_file_commits_on_committed_date_file_id_and_project_id", unique: true
+ end
+
+ create_table "analytics_repository_file_edits", force: :cascade do |t|
+ t.bigint "project_id", null: false
+ t.bigint "analytics_repository_file_id", null: false
+ t.date "committed_date", null: false
+ t.integer "num_edits", default: 0, null: false
+ t.index ["analytics_repository_file_id", "committed_date", "project_id"], name: "index_file_edits_on_committed_date_file_id_and_project_id", unique: true
+ t.index ["project_id"], name: "index_analytics_repository_file_edits_on_project_id"
+ end
+
+ create_table "analytics_repository_files", force: :cascade do |t|
+ t.bigint "project_id", null: false
+ t.string "file_path", limit: 4096, null: false
+ t.index ["project_id", "file_path"], name: "index_analytics_repository_files_on_project_id_and_file_path", unique: true
+ end
+
create_table "appearances", id: :serial, force: :cascade do |t|
t.string "title", null: false
t.text "description", null: false
@@ -307,6 +331,16 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "encrypted_asset_proxy_secret_key_iv"
t.string "static_objects_external_storage_url", limit: 255
t.string "static_objects_external_storage_auth_token", limit: 255
+ t.boolean "throttle_protected_paths_enabled", default: true, null: false
+ t.integer "throttle_protected_paths_requests_per_period", default: 10, null: false
+ t.integer "throttle_protected_paths_period_in_seconds", default: 60, null: false
+ t.string "protected_paths", limit: 255, default: ["/users/password", "/users/sign_in", "/api/v3/session.json", "/api/v3/session", "/api/v4/session.json", "/api/v4/session", "/users", "/users/confirmation", "/unsubscribes/", "/import/github/personal_access_token"], array: true
+ t.boolean "throttle_incident_management_notification_enabled", default: false, null: false
+ t.integer "throttle_incident_management_notification_period_in_seconds", default: 3600
+ t.integer "throttle_incident_management_notification_per_period", default: 3600
+ t.integer "push_event_hooks_limit", default: 3, null: false
+ t.integer "push_event_activities_limit", default: 3, null: false
+ t.string "custom_http_clone_url_root", limit: 511
t.index ["custom_project_templates_group_id"], name: "index_application_settings_on_custom_project_templates_group_id"
t.index ["file_template_project_id"], name: "index_application_settings_on_file_template_project_id"
t.index ["instance_administration_project_id"], name: "index_applicationsettings_on_instance_administration_project_id"
@@ -435,6 +469,15 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["user_id", "name"], name: "index_award_emoji_on_user_id_and_name"
end
+ create_table "aws_roles", primary_key: "user_id", id: :integer, default: nil, force: :cascade do |t|
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "role_arn", limit: 2048, null: false
+ t.string "role_external_id", limit: 64, null: false
+ t.index ["role_external_id"], name: "index_aws_roles_on_role_external_id", unique: true
+ t.index ["user_id"], name: "index_aws_roles_on_user_id", unique: true
+ end
+
create_table "badges", id: :serial, force: :cascade do |t|
t.string "link_url", null: false
t.string "image_url", null: false
@@ -624,6 +667,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["name"], name: "index_ci_builds_on_name_for_security_products_values", 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]))"
t.index ["project_id", "id"], name: "index_ci_builds_on_project_id_and_id"
t.index ["project_id", "status"], name: "index_ci_builds_project_id_and_status_for_live_jobs_partial2", where: "(((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])))"
+ t.index ["project_id"], name: "index_ci_builds_on_project_id_for_successfull_pages_deploy", where: "(((type)::text = 'GenericCommitStatus'::text) AND ((stage)::text = 'deploy'::text) AND ((name)::text = 'pages:deploy'::text) AND ((status)::text = 'success'::text))"
t.index ["protected"], name: "index_ci_builds_on_protected"
t.index ["queued_at"], name: "index_ci_builds_on_queued_at"
t.index ["runner_id"], name: "index_ci_builds_on_runner_id"
@@ -874,7 +918,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.datetime "updated_at"
t.integer "commit_id"
t.index ["commit_id"], name: "index_ci_trigger_requests_on_commit_id"
- t.index ["trigger_id"], name: "index_ci_trigger_requests_on_trigger_id"
+ t.index ["trigger_id", "id"], name: "index_ci_trigger_requests_on_trigger_id_and_id", order: { id: :desc }
end
create_table "ci_triggers", id: :serial, force: :cascade do |t|
@@ -935,6 +979,30 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["project_id"], name: "index_cluster_projects_on_project_id"
end
+ create_table "cluster_providers_aws", force: :cascade do |t|
+ t.bigint "cluster_id", null: false
+ t.integer "created_by_user_id"
+ t.integer "num_nodes", null: false
+ t.integer "status", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "key_name", limit: 255, null: false
+ t.string "role_arn", limit: 2048, null: false
+ t.string "region", limit: 255, null: false
+ t.string "vpc_id", limit: 255, null: false
+ t.string "subnet_ids", limit: 255, default: [], null: false, array: true
+ t.string "security_group_id", limit: 255, null: false
+ t.string "instance_type", limit: 255, null: false
+ t.string "access_key_id", limit: 255
+ t.string "encrypted_secret_access_key_iv", limit: 255
+ t.text "encrypted_secret_access_key"
+ t.text "session_token"
+ t.text "status_reason"
+ t.index ["cluster_id", "status"], name: "index_cluster_providers_aws_on_cluster_id_and_status"
+ t.index ["cluster_id"], name: "index_cluster_providers_aws_on_cluster_id", unique: true
+ t.index ["created_by_user_id"], name: "index_cluster_providers_aws_on_created_by_user_id"
+ end
+
create_table "cluster_providers_gcp", id: :serial, force: :cascade do |t|
t.integer "cluster_id", null: false
t.integer "status"
@@ -950,6 +1018,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.text "encrypted_access_token"
t.string "encrypted_access_token_iv"
t.boolean "legacy_abac", default: false, null: false
+ t.boolean "cloud_run", default: false, null: false
+ t.index ["cloud_run"], name: "index_cluster_providers_gcp_on_cloud_run"
t.index ["cluster_id"], name: "index_cluster_providers_gcp_on_cluster_id", unique: true
end
@@ -966,7 +1036,9 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "domain"
t.boolean "managed", default: true, null: false
t.boolean "namespace_per_environment", default: true, null: false
+ t.integer "management_project_id"
t.index ["enabled"], name: "index_clusters_on_enabled"
+ t.index ["management_project_id"], name: "index_clusters_on_management_project_id", where: "(management_project_id IS NOT NULL)"
t.index ["user_id"], name: "index_clusters_on_user_id"
end
@@ -1194,9 +1266,21 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["project_id", "status"], name: "index_deployments_on_project_id_and_status"
end
+ create_table "description_versions", force: :cascade do |t|
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.integer "issue_id"
+ t.integer "merge_request_id"
+ t.integer "epic_id"
+ t.text "description"
+ t.index ["epic_id"], name: "index_description_versions_on_epic_id", where: "(epic_id IS NOT NULL)"
+ t.index ["issue_id"], name: "index_description_versions_on_issue_id", where: "(issue_id IS NOT NULL)"
+ t.index ["merge_request_id"], name: "index_description_versions_on_merge_request_id", where: "(merge_request_id IS NOT NULL)"
+ end
+
create_table "design_management_designs", force: :cascade do |t|
t.integer "project_id", null: false
- t.integer "issue_id", null: false
+ t.integer "issue_id"
t.string "filename", null: false
t.index ["issue_id", "filename"], name: "index_design_management_designs_on_issue_id_and_filename", unique: true
t.index ["project_id"], name: "index_design_management_designs_on_project_id"
@@ -1215,8 +1299,11 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
create_table "design_management_versions", force: :cascade do |t|
t.binary "sha", null: false
t.bigint "issue_id"
+ t.integer "user_id"
+ t.datetime_with_timezone "created_at"
t.index ["issue_id"], name: "index_design_management_versions_on_issue_id"
t.index ["sha", "issue_id"], name: "index_design_management_versions_on_sha_and_issue_id", unique: true
+ t.index ["user_id"], name: "index_design_management_versions_on_user_id", where: "(user_id IS NOT NULL)"
end
create_table "draft_notes", force: :cascade do |t|
@@ -1350,6 +1437,15 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["target_type", "target_id"], name: "index_events_on_target_type_and_target_id"
end
+ create_table "evidences", force: :cascade do |t|
+ t.bigint "release_id", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.binary "summary_sha"
+ t.jsonb "summary", default: {}, null: false
+ t.index ["release_id"], name: "index_evidences_on_release_id"
+ end
+
create_table "external_pull_requests", force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
@@ -1679,6 +1775,16 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["project_id"], name: "index_gpg_signatures_on_project_id"
end
+ create_table "grafana_integrations", force: :cascade do |t|
+ t.bigint "project_id", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "encrypted_token", limit: 255, null: false
+ t.string "encrypted_token_iv", limit: 255, null: false
+ t.string "grafana_url", limit: 1024, null: false
+ t.index ["project_id"], name: "index_grafana_integrations_on_project_id"
+ end
+
create_table "group_custom_attributes", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
@@ -1778,6 +1884,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.datetime "first_added_to_board_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.index ["issue_id", "first_mentioned_in_commit_at", "first_associated_with_milestone_at", "first_added_to_board_at"], name: "index_issue_metrics_on_issue_id_and_timestamps"
t.index ["issue_id"], name: "index_issue_metrics"
end
@@ -1821,7 +1928,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.boolean "discussion_locked"
t.datetime_with_timezone "closed_at"
t.integer "closed_by_id"
- t.integer "state_id", limit: 2
+ t.integer "state_id", limit: 2, default: 1, null: false
t.integer "duplicated_to_id"
t.index ["author_id"], name: "index_issues_on_author_id"
t.index ["closed_by_id"], name: "index_issues_on_closed_by_id"
@@ -1831,17 +1938,40 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["milestone_id"], name: "index_issues_on_milestone_id"
t.index ["moved_to_id"], name: "index_issues_on_moved_to_id", where: "(moved_to_id IS NOT NULL)"
t.index ["project_id", "created_at", "id", "state"], name: "index_issues_on_project_id_and_created_at_and_id_and_state"
+ t.index ["project_id", "created_at", "id", "state_id"], name: "idx_issues_on_project_id_and_created_at_and_id_and_state_id"
t.index ["project_id", "due_date", "id", "state"], name: "idx_issues_on_project_id_and_due_date_and_id_and_state_partial", where: "(due_date IS NOT NULL)"
+ t.index ["project_id", "due_date", "id", "state_id"], name: "idx_issues_on_project_id_and_due_date_and_id_and_state_id", where: "(due_date IS NOT NULL)"
t.index ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true
t.index ["project_id", "relative_position", "state", "id"], name: "index_issues_on_project_id_and_rel_position_and_state_and_id", order: { id: :desc }
+ t.index ["project_id", "relative_position", "state_id", "id"], name: "idx_issues_on_project_id_and_rel_position_and_state_id_and_id", order: { id: :desc }
t.index ["project_id", "updated_at", "id", "state"], name: "index_issues_on_project_id_and_updated_at_and_id_and_state"
+ t.index ["project_id", "updated_at", "id", "state_id"], name: "idx_issues_on_project_id_and_updated_at_and_id_and_state_id"
t.index ["relative_position"], name: "index_issues_on_relative_position"
t.index ["state"], name: "index_issues_on_state"
+ t.index ["state_id"], name: "idx_issues_on_state_id"
t.index ["title"], name: "index_issues_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["updated_at"], name: "index_issues_on_updated_at"
t.index ["updated_by_id"], name: "index_issues_on_updated_by_id", where: "(updated_by_id IS NOT NULL)"
end
+ create_table "issues_prometheus_alert_events", id: false, force: :cascade do |t|
+ t.bigint "issue_id", null: false
+ t.bigint "prometheus_alert_event_id", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.index ["issue_id", "prometheus_alert_event_id"], name: "issue_id_prometheus_alert_event_id_index", unique: true
+ t.index ["prometheus_alert_event_id"], name: "issue_id_issues_prometheus_alert_events_index"
+ end
+
+ create_table "issues_self_managed_prometheus_alert_events", id: false, force: :cascade do |t|
+ t.bigint "issue_id", null: false
+ t.bigint "self_managed_prometheus_alert_event_id", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.index ["issue_id", "self_managed_prometheus_alert_event_id"], name: "issue_id_self_managed_prometheus_alert_event_id_index", unique: true
+ t.index ["self_managed_prometheus_alert_event_id"], name: "issue_id_issues_self_managed_rometheus_alert_events_index"
+ end
+
create_table "jira_connect_installations", force: :cascade do |t|
t.string "client_key"
t.string "encrypted_shared_secret"
@@ -1997,6 +2127,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.datetime "updated_at", null: false
t.integer "user_id"
t.integer "milestone_id"
+ t.integer "max_issue_count", default: 0, null: false
t.index ["board_id", "label_id"], name: "index_lists_on_board_id_and_label_id", unique: true
t.index ["label_id"], name: "index_lists_on_label_id"
t.index ["list_type"], name: "index_lists_on_list_type"
@@ -2162,22 +2293,27 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.boolean "discussion_locked"
t.integer "latest_merge_request_diff_id"
t.boolean "allow_maintainer_to_push"
- t.integer "state_id", limit: 2
+ t.integer "state_id", limit: 2, default: 1, null: false
t.string "rebase_jid"
t.index ["assignee_id"], name: "index_merge_requests_on_assignee_id"
t.index ["author_id"], name: "index_merge_requests_on_author_id"
t.index ["created_at"], name: "index_merge_requests_on_created_at"
t.index ["description"], name: "index_merge_requests_on_description_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["head_pipeline_id"], name: "index_merge_requests_on_head_pipeline_id"
+ t.index ["id", "merge_jid"], name: "idx_merge_requests_on_id_and_merge_jid", where: "((merge_jid IS NOT NULL) AND (state_id = 4))"
t.index ["id", "merge_jid"], name: "index_merge_requests_on_id_and_merge_jid", where: "((merge_jid IS NOT NULL) AND ((state)::text = 'locked'::text))"
t.index ["latest_merge_request_diff_id"], name: "index_merge_requests_on_latest_merge_request_diff_id"
t.index ["merge_user_id"], name: "index_merge_requests_on_merge_user_id", where: "(merge_user_id IS NOT NULL)"
t.index ["milestone_id"], name: "index_merge_requests_on_milestone_id"
t.index ["source_branch"], name: "index_merge_requests_on_source_branch"
+ t.index ["source_project_id", "source_branch"], name: "idx_merge_requests_on_source_project_and_branch_state_opened", where: "(state_id = 1)"
t.index ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_and_branch_state_opened", where: "((state)::text = 'opened'::text)"
t.index ["source_project_id", "source_branch"], name: "index_merge_requests_on_source_project_id_and_source_branch"
t.index ["state", "merge_status"], name: "index_merge_requests_on_state_and_merge_status", where: "(((state)::text = 'opened'::text) AND ((merge_status)::text = 'can_be_merged'::text))"
+ t.index ["state_id", "merge_status"], name: "idx_merge_requests_on_state_id_and_merge_status", where: "((state_id = 1) AND ((merge_status)::text = 'can_be_merged'::text))"
t.index ["target_branch"], name: "index_merge_requests_on_target_branch"
+ t.index ["target_project_id", "created_at"], name: "index_merge_requests_target_project_id_created_at"
+ t.index ["target_project_id", "iid"], name: "idx_merge_requests_on_target_project_id_and_iid_opened", where: "(state_id = 1)"
t.index ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true
t.index ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid_opened", where: "((state)::text = 'opened'::text)"
t.index ["target_project_id", "merge_commit_sha", "id"], name: "index_merge_requests_on_tp_id_and_merge_commit_sha_and_id"
@@ -2272,7 +2408,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.boolean "membership_lock", default: false
t.boolean "share_with_group_lock", default: false
t.integer "visibility_level", default: 20, null: false
- t.boolean "request_access_enabled", default: false, null: false
+ t.boolean "request_access_enabled", default: true, null: false
t.string "ldap_sync_status", default: "ready", null: false
t.string "ldap_sync_error"
t.datetime "ldap_sync_last_update_at"
@@ -2300,6 +2436,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.integer "last_ci_minutes_usage_notification_level"
t.integer "subgroup_creation_level", default: 1
t.boolean "emails_disabled"
+ t.integer "max_pages_size"
+ t.integer "max_artifacts_size"
t.index ["created_at"], name: "index_namespaces_on_created_at"
t.index ["custom_project_templates_group_id", "type"], name: "index_namespaces_on_custom_project_templates_group_id_and_type", where: "(custom_project_templates_group_id IS NOT NULL)"
t.index ["file_template_project_id"], name: "index_namespaces_on_file_template_project_id"
@@ -2393,6 +2531,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.boolean "issue_due"
t.boolean "new_epic"
t.string "notification_email"
+ t.boolean "new_release"
t.index ["source_id", "source_type"], name: "index_notification_settings_on_source_id_and_source_type"
t.index ["user_id", "source_id", "source_type"], name: "index_notifications_on_user_id_and_source_id_and_source_type", unique: true
t.index ["user_id"], name: "index_notification_settings_on_user_id"
@@ -2518,6 +2657,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "name", null: false
t.string "version"
t.integer "package_type", limit: 2, null: false
+ t.index ["name"], name: "index_packages_packages_on_name_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["project_id"], name: "index_packages_packages_on_project_id"
end
@@ -2757,6 +2897,13 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["status"], name: "index_project_mirror_data_on_status"
end
+ create_table "project_pages_metadata", id: false, force: :cascade do |t|
+ t.bigint "project_id", null: false
+ t.boolean "deployed", default: false, null: false
+ t.index ["project_id"], name: "index_project_pages_metadata_on_project_id", unique: true
+ t.index ["project_id"], name: "index_project_pages_metadata_on_project_id_and_deployed_is_true", where: "(deployed = true)"
+ end
+
create_table "project_repositories", force: :cascade do |t|
t.integer "shard_id", null: false
t.string "disk_path", null: false
@@ -2851,7 +2998,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.boolean "has_external_issue_tracker"
t.string "repository_storage", default: "default", null: false
t.boolean "repository_read_only"
- t.boolean "request_access_enabled", default: false, null: false
+ t.boolean "request_access_enabled", default: true, null: false
t.boolean "has_external_wiki"
t.string "ci_config_path"
t.boolean "lfs_enabled"
@@ -2885,6 +3032,10 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.boolean "merge_requests_disable_committers_approval"
t.boolean "require_password_to_approve"
t.boolean "emails_disabled"
+ t.integer "max_pages_size"
+ t.integer "max_artifacts_size"
+ t.string "pull_mirror_branch_prefix", limit: 50
+ t.index "lower((name)::text)", name: "index_projects_on_lower_name"
t.index ["archived", "pending_delete", "merge_requests_require_code_owner_approval"], name: "projects_requiring_code_owner_approval", where: "((pending_delete = false) AND (archived = false) AND (merge_requests_require_code_owner_approval = true))"
t.index ["created_at"], name: "index_projects_on_created_at"
t.index ["creator_id"], name: "index_projects_on_creator_id"
@@ -3049,6 +3200,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.binary "commit_to"
t.text "ref"
t.string "commit_title", limit: 70
+ t.integer "ref_count"
t.index ["event_id"], name: "index_push_event_payloads_on_event_id", unique: true
end
@@ -3081,6 +3233,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "path", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.index "lower((path)::text) varchar_pattern_ops", name: "index_redirect_routes_on_path_unique_text_pattern_ops", unique: true
t.index ["path"], name: "index_redirect_routes_on_path", unique: true
t.index ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id"
end
@@ -3099,8 +3252,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "tag"
t.text "description"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.text "description_html"
t.integer "cached_markdown_version"
t.integer "author_id"
@@ -3197,6 +3350,19 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["group_id", "token_encrypted"], name: "index_scim_oauth_access_tokens_on_group_id_and_token_encrypted", unique: true
end
+ create_table "self_managed_prometheus_alert_events", force: :cascade do |t|
+ t.bigint "project_id", null: false
+ t.bigint "environment_id"
+ t.datetime_with_timezone "started_at", null: false
+ t.datetime_with_timezone "ended_at"
+ t.integer "status", limit: 2, null: false
+ t.string "title", limit: 255, null: false
+ t.string "query_expression", limit: 255
+ t.string "payload_key", limit: 255, null: false
+ t.index ["environment_id"], name: "index_self_managed_prometheus_alert_events_on_environment_id"
+ t.index ["project_id", "payload_key"], name: "idx_project_id_payload_key_self_managed_prometheus_alert_events", unique: true
+ end
+
create_table "sent_notifications", id: :serial, force: :cascade do |t|
t.integer "project_id"
t.integer "noteable_id"
@@ -3281,8 +3447,9 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.text "description"
t.text "description_html"
t.index ["author_id"], name: "index_snippets_on_author_id"
+ t.index ["content"], name: "index_snippets_on_content_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["file_name"], name: "index_snippets_on_file_name_trigram", opclass: :gin_trgm_ops, using: :gin
- t.index ["project_id"], name: "index_snippets_on_project_id"
+ t.index ["project_id", "visibility_level"], name: "index_snippets_on_project_id_and_visibility_level"
t.index ["title"], name: "index_snippets_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["updated_at"], name: "index_snippets_on_updated_at"
t.index ["visibility_level"], name: "index_snippets_on_visibility_level"
@@ -3298,7 +3465,9 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
create_table "software_licenses", id: :serial, force: :cascade do |t|
t.string "name", null: false
+ t.string "spdx_identifier", limit: 255
t.index ["name"], name: "index_software_licenses_on_name"
+ t.index ["spdx_identifier"], name: "index_software_licenses_on_spdx_identifier"
end
create_table "spam_logs", id: :serial, force: :cascade do |t|
@@ -3346,6 +3515,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "action"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.bigint "description_version_id"
+ t.index ["description_version_id"], name: "index_system_note_metadata_on_description_version_id", unique: true, where: "(description_version_id IS NOT NULL)"
t.index ["note_id"], name: "index_system_note_metadata_on_note_id", unique: true
end
@@ -3609,6 +3780,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "first_name", limit: 255
t.string "last_name", limit: 255
t.string "static_object_token", limit: 255
+ t.integer "role", limit: 2
+ t.index "lower((name)::text)", name: "index_on_users_name_lower"
t.index ["accepted_term_id"], name: "index_users_on_accepted_term_id"
t.index ["admin"], name: "index_users_on_admin"
t.index ["bot_type"], name: "index_users_on_bot_type"
@@ -3652,6 +3825,42 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.index ["user_id", "project_id"], name: "index_users_star_projects_on_user_id_and_project_id", unique: true
end
+ create_table "vulnerabilities", force: :cascade do |t|
+ t.bigint "milestone_id"
+ t.bigint "epic_id"
+ t.bigint "project_id", null: false
+ t.bigint "author_id", null: false
+ t.bigint "updated_by_id"
+ t.bigint "last_edited_by_id"
+ t.date "start_date"
+ t.date "due_date"
+ t.datetime_with_timezone "last_edited_at"
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.string "title", limit: 255, null: false
+ t.text "title_html", null: false
+ t.text "description"
+ t.text "description_html"
+ t.bigint "start_date_sourcing_milestone_id"
+ t.bigint "due_date_sourcing_milestone_id"
+ t.bigint "closed_by_id"
+ t.datetime_with_timezone "closed_at"
+ t.integer "state", limit: 2, default: 1, null: false
+ t.integer "severity", limit: 2, null: false
+ t.boolean "severity_overridden", default: false
+ t.integer "confidence", limit: 2, null: false
+ t.boolean "confidence_overridden", default: false
+ t.index ["author_id"], name: "index_vulnerabilities_on_author_id"
+ t.index ["closed_by_id"], name: "index_vulnerabilities_on_closed_by_id"
+ t.index ["due_date_sourcing_milestone_id"], name: "index_vulnerabilities_on_due_date_sourcing_milestone_id"
+ t.index ["epic_id"], name: "index_vulnerabilities_on_epic_id"
+ t.index ["last_edited_by_id"], name: "index_vulnerabilities_on_last_edited_by_id"
+ t.index ["milestone_id"], name: "index_vulnerabilities_on_milestone_id"
+ t.index ["project_id"], name: "index_vulnerabilities_on_project_id"
+ t.index ["start_date_sourcing_milestone_id"], name: "index_vulnerabilities_on_start_date_sourcing_milestone_id"
+ t.index ["updated_by_id"], name: "index_vulnerabilities_on_updated_by_id"
+ end
+
create_table "vulnerability_feedback", id: :serial, force: :cascade do |t|
t.datetime_with_timezone "created_at", null: false
t.datetime_with_timezone "updated_at", null: false
@@ -3719,10 +3928,12 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
t.string "name", null: false
t.string "metadata_version", null: false
t.text "raw_metadata", null: false
+ t.bigint "vulnerability_id"
t.index ["primary_identifier_id"], name: "index_vulnerability_occurrences_on_primary_identifier_id"
t.index ["project_id", "primary_identifier_id", "location_fingerprint", "scanner_id"], name: "index_vulnerability_occurrences_on_unique_keys", unique: true
t.index ["scanner_id"], name: "index_vulnerability_occurrences_on_scanner_id"
t.index ["uuid"], name: "index_vulnerability_occurrences_on_uuid", unique: true
+ t.index ["vulnerability_id"], name: "index_vulnerability_occurrences_on_vulnerability_id"
end
create_table "vulnerability_scanners", force: :cascade do |t|
@@ -3789,6 +4000,11 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "analytics_cycle_analytics_project_stages", "projects", on_delete: :cascade
add_foreign_key "analytics_language_trend_repository_languages", "programming_languages", on_delete: :cascade
add_foreign_key "analytics_language_trend_repository_languages", "projects", on_delete: :cascade
+ add_foreign_key "analytics_repository_file_commits", "analytics_repository_files", on_delete: :cascade
+ add_foreign_key "analytics_repository_file_commits", "projects", on_delete: :cascade
+ add_foreign_key "analytics_repository_file_edits", "analytics_repository_files", on_delete: :cascade
+ add_foreign_key "analytics_repository_file_edits", "projects", on_delete: :cascade
+ add_foreign_key "analytics_repository_files", "projects", on_delete: :cascade
add_foreign_key "application_settings", "namespaces", column: "custom_project_templates_group_id", on_delete: :nullify
add_foreign_key "application_settings", "projects", column: "file_template_project_id", name: "fk_ec757bd087", on_delete: :nullify
add_foreign_key "application_settings", "projects", column: "instance_administration_project_id", on_delete: :nullify
@@ -3809,6 +4025,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "approval_project_rules_users", "users", on_delete: :cascade
add_foreign_key "approvals", "merge_requests", name: "fk_310d714958", on_delete: :cascade
add_foreign_key "approver_groups", "namespaces", column: "group_id", on_delete: :cascade
+ add_foreign_key "aws_roles", "users", on_delete: :cascade
add_foreign_key "badges", "namespaces", column: "group_id", on_delete: :cascade
add_foreign_key "badges", "projects", on_delete: :cascade
add_foreign_key "board_assignees", "boards", on_delete: :cascade
@@ -3872,7 +4089,10 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "cluster_platforms_kubernetes", "clusters", on_delete: :cascade
add_foreign_key "cluster_projects", "clusters", on_delete: :cascade
add_foreign_key "cluster_projects", "projects", on_delete: :cascade
+ add_foreign_key "cluster_providers_aws", "clusters", on_delete: :cascade
+ add_foreign_key "cluster_providers_aws", "users", column: "created_by_user_id", on_delete: :nullify
add_foreign_key "cluster_providers_gcp", "clusters", on_delete: :cascade
+ add_foreign_key "clusters", "projects", column: "management_project_id", name: "fk_f05c5e5a42", on_delete: :nullify
add_foreign_key "clusters", "users", on_delete: :nullify
add_foreign_key "clusters_applications_cert_managers", "clusters", on_delete: :cascade
add_foreign_key "clusters_applications_helm", "clusters", on_delete: :cascade
@@ -3893,11 +4113,15 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "deploy_keys_projects", "projects", name: "fk_58a901ca7e", on_delete: :cascade
add_foreign_key "deployments", "clusters", name: "fk_289bba3222", on_delete: :nullify
add_foreign_key "deployments", "projects", name: "fk_b9a3851b82", on_delete: :cascade
+ add_foreign_key "description_versions", "epics", on_delete: :cascade
+ add_foreign_key "description_versions", "issues", on_delete: :cascade
+ add_foreign_key "description_versions", "merge_requests", on_delete: :cascade
add_foreign_key "design_management_designs", "issues", on_delete: :cascade
add_foreign_key "design_management_designs", "projects", on_delete: :cascade
add_foreign_key "design_management_designs_versions", "design_management_designs", column: "design_id", name: "fk_03c671965c", on_delete: :cascade
add_foreign_key "design_management_designs_versions", "design_management_versions", column: "version_id", name: "fk_f4d25ba00c", on_delete: :cascade
add_foreign_key "design_management_versions", "issues", on_delete: :cascade
+ add_foreign_key "design_management_versions", "users", name: "fk_ee16b939e5", on_delete: :nullify
add_foreign_key "draft_notes", "merge_requests", on_delete: :cascade
add_foreign_key "draft_notes", "users", column: "author_id", on_delete: :cascade
add_foreign_key "elasticsearch_indexed_namespaces", "namespaces", on_delete: :cascade
@@ -3915,6 +4139,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "events", "namespaces", column: "group_id", name: "fk_61fbf6ca48", on_delete: :cascade
add_foreign_key "events", "projects", on_delete: :cascade
add_foreign_key "events", "users", column: "author_id", name: "fk_edfd187b6f", on_delete: :cascade
+ add_foreign_key "evidences", "releases", on_delete: :cascade
add_foreign_key "external_pull_requests", "projects", on_delete: :cascade
add_foreign_key "fork_network_members", "fork_networks", on_delete: :cascade
add_foreign_key "fork_network_members", "projects", column: "forked_from_project_id", name: "fk_b01280dae4", on_delete: :nullify
@@ -3951,6 +4176,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "gpg_signatures", "gpg_key_subkeys", on_delete: :nullify
add_foreign_key "gpg_signatures", "gpg_keys", on_delete: :nullify
add_foreign_key "gpg_signatures", "projects", on_delete: :cascade
+ add_foreign_key "grafana_integrations", "projects", on_delete: :cascade
add_foreign_key "group_custom_attributes", "namespaces", column: "group_id", on_delete: :cascade
add_foreign_key "identities", "saml_providers", name: "fk_aade90f0fc", on_delete: :cascade
add_foreign_key "import_export_uploads", "projects", on_delete: :cascade
@@ -3973,6 +4199,10 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "issues", "users", column: "author_id", name: "fk_05f1e72feb", on_delete: :nullify
add_foreign_key "issues", "users", column: "closed_by_id", name: "fk_c63cbf6c25", on_delete: :nullify
add_foreign_key "issues", "users", column: "updated_by_id", name: "fk_ffed080f01", on_delete: :nullify
+ add_foreign_key "issues_prometheus_alert_events", "issues", on_delete: :cascade
+ add_foreign_key "issues_prometheus_alert_events", "prometheus_alert_events", on_delete: :cascade
+ add_foreign_key "issues_self_managed_prometheus_alert_events", "issues", on_delete: :cascade
+ add_foreign_key "issues_self_managed_prometheus_alert_events", "self_managed_prometheus_alert_events", on_delete: :cascade
add_foreign_key "jira_connect_subscriptions", "jira_connect_installations", on_delete: :cascade
add_foreign_key "jira_connect_subscriptions", "namespaces", on_delete: :cascade
add_foreign_key "jira_tracker_data", "services", on_delete: :cascade
@@ -4064,6 +4294,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "project_incident_management_settings", "projects", on_delete: :cascade
add_foreign_key "project_metrics_settings", "projects", on_delete: :cascade
add_foreign_key "project_mirror_data", "projects", name: "fk_d1aad367d7", on_delete: :cascade
+ add_foreign_key "project_pages_metadata", "projects", on_delete: :cascade
add_foreign_key "project_repositories", "projects", on_delete: :cascade
add_foreign_key "project_repositories", "shards", on_delete: :restrict
add_foreign_key "project_repository_states", "projects", on_delete: :cascade
@@ -4111,6 +4342,8 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "reviews", "users", column: "author_id", on_delete: :nullify
add_foreign_key "saml_providers", "namespaces", column: "group_id", on_delete: :cascade
add_foreign_key "scim_oauth_access_tokens", "namespaces", column: "group_id", on_delete: :cascade
+ add_foreign_key "self_managed_prometheus_alert_events", "environments", on_delete: :cascade
+ add_foreign_key "self_managed_prometheus_alert_events", "projects", on_delete: :cascade
add_foreign_key "services", "projects", name: "fk_71cce407f9", on_delete: :cascade
add_foreign_key "slack_integrations", "services", on_delete: :cascade
add_foreign_key "smartcard_identities", "users", on_delete: :cascade
@@ -4119,6 +4352,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "software_license_policies", "software_licenses", on_delete: :cascade
add_foreign_key "subscriptions", "projects", on_delete: :cascade
add_foreign_key "suggestions", "notes", on_delete: :cascade
+ add_foreign_key "system_note_metadata", "description_versions", name: "fk_fbd87415c9", on_delete: :nullify
add_foreign_key "system_note_metadata", "notes", name: "fk_d83a918cb1", on_delete: :cascade
add_foreign_key "term_agreements", "application_setting_terms", column: "term_id"
add_foreign_key "term_agreements", "users", on_delete: :cascade
@@ -4143,6 +4377,15 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "users_ops_dashboard_projects", "projects", on_delete: :cascade
add_foreign_key "users_ops_dashboard_projects", "users", on_delete: :cascade
add_foreign_key "users_star_projects", "projects", name: "fk_22cd27ddfc", on_delete: :cascade
+ add_foreign_key "vulnerabilities", "epics", name: "fk_1d37cddf91", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "milestones", column: "due_date_sourcing_milestone_id", name: "fk_7c5bb22a22", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "milestones", column: "start_date_sourcing_milestone_id", name: "fk_88b4d546ef", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "milestones", name: "fk_131d289c65", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "projects", name: "fk_efb96ab1e2", on_delete: :cascade
+ add_foreign_key "vulnerabilities", "users", column: "author_id", name: "fk_b1de915a15", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "users", column: "closed_by_id", name: "fk_cf5c60acbf", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "users", column: "last_edited_by_id", name: "fk_1302949740", on_delete: :nullify
+ add_foreign_key "vulnerabilities", "users", column: "updated_by_id", name: "fk_7ac31eacb9", on_delete: :nullify
add_foreign_key "vulnerability_feedback", "ci_pipelines", column: "pipeline_id", on_delete: :nullify
add_foreign_key "vulnerability_feedback", "issues", on_delete: :nullify
add_foreign_key "vulnerability_feedback", "merge_requests", name: "fk_563ff1912e", on_delete: :nullify
@@ -4155,6 +4398,7 @@ ActiveRecord::Schema.define(version: 2019_09_18_104222) do
add_foreign_key "vulnerability_occurrence_pipelines", "ci_pipelines", column: "pipeline_id", on_delete: :cascade
add_foreign_key "vulnerability_occurrence_pipelines", "vulnerability_occurrences", column: "occurrence_id", on_delete: :cascade
add_foreign_key "vulnerability_occurrences", "projects", on_delete: :cascade
+ add_foreign_key "vulnerability_occurrences", "vulnerabilities", name: "fk_97ffe77653", on_delete: :nullify
add_foreign_key "vulnerability_occurrences", "vulnerability_identifiers", column: "primary_identifier_id", on_delete: :cascade
add_foreign_key "vulnerability_occurrences", "vulnerability_scanners", column: "scanner_id", on_delete: :cascade
add_foreign_key "vulnerability_scanners", "projects", on_delete: :cascade