debian-mirror-gitlab/db/migrate/20200610130002_create_vulnerability_statistics.rb

31 lines
920 B
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# 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
end
end
end