summaryrefslogtreecommitdiff
path: root/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb')
-rw-r--r--db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb b/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb
new file mode 100644
index 00000000000..7562a32a25e
--- /dev/null
+++ b/db/migrate/20200702123805_change_project_id_index_to_be_unique_on_vulnerability_statistics_table.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class ChangeProjectIdIndexToBeUniqueOnVulnerabilityStatisticsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ INDEX_NAME = 'index_vulnerability_statistics_on_unique_project_id'
+
+ def up
+ remove_index :vulnerability_statistics, :project_id # rubocop:disable Migration/RemoveIndex (table is empty)
+ add_index :vulnerability_statistics, :project_id, name: INDEX_NAME, unique: true # rubocop:disable Migration/AddIndex (table is empty)
+ end
+
+ def down
+ remove_index :vulnerability_statistics, name: INDEX_NAME # rubocop:disable Migration/RemoveIndex (table is empty)
+ add_index :vulnerability_statistics, :project_id # rubocop:disable Migration/AddIndex (table is empty)
+ end
+end