2020-06-17 23:08:26 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CreateVulnerabilityStatistics < ActiveRecord::Migration[6.0]
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
def up
|
|
|
|
with_lock_retries do
|
|
|
|
create_table :vulnerability_statistics do |t|
|
|
|
|
t.timestamps_with_timezone null: false
|
|
|
|
t.references :project, null: false, foreign_key: { on_delete: :cascade }
|
|
|
|
t.integer :total, default: 0, null: false
|
|
|
|
t.integer :critical, default: 0, null: false
|
|
|
|
t.integer :high, default: 0, null: false
|
|
|
|
t.integer :medium, default: 0, null: false
|
|
|
|
t.integer :low, default: 0, null: false
|
|
|
|
t.integer :unknown, default: 0, null: false
|
|
|
|
t.integer :info, default: 0, null: false
|
|
|
|
t.integer :letter_grade, limit: 1, index: true, null: false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
with_lock_retries do
|
2020-06-23 20:08:43 -04:00
|
|
|
drop_table :vulnerability_statistics
|
2020-06-17 23:08:26 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|