31 lines
958 B
Ruby
31 lines
958 B
Ruby
![]() |
# 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
|
||
|
drop_table :vulnerability_statistics # rubocop:disable Migration/DropTable
|
||
|
end
|
||
|
end
|
||
|
end
|