summaryrefslogtreecommitdiff
path: root/db/migrate/20200825084819_create_security_findings_table.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200825084819_create_security_findings_table.rb')
-rw-r--r--db/migrate/20200825084819_create_security_findings_table.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/db/migrate/20200825084819_create_security_findings_table.rb b/db/migrate/20200825084819_create_security_findings_table.rb
new file mode 100644
index 00000000000..d44b4671e2f
--- /dev/null
+++ b/db/migrate/20200825084819_create_security_findings_table.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class CreateSecurityFindingsTable < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:security_findings)
+ create_table :security_findings do |t|
+ t.references :scan, null: false
+ t.references :scanner, null: false
+ t.integer :severity, limit: 2, index: true, null: false
+ t.integer :confidence, limit: 2, index: true, null: false
+ t.text :project_fingerprint, index: true, null: false
+ end
+ end
+
+ add_text_limit :security_findings, :project_fingerprint, 40
+ end
+
+ def down
+ drop_table :security_findings
+ end
+end