blob: 4b32570ea56d2414792af323232db64c0ef01d14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# frozen_string_literal: true
class AddSecureflagTrainingProvider < Gitlab::Database::Migration[2.1]
disable_ddl_transaction!
restrict_gitlab_migration gitlab_schema: :gitlab_main
SECUREFLAG_DATA = {
name: 'SecureFlag',
description: "Get remediation advice with example code and recommended hands-on labs in a fully
interactive virtualised environment.",
url: "https://knowledge-base-api.secureflag.com/gitlab"
}
class TrainingProvider < MigrationRecord
self.table_name = 'security_training_providers'
end
def up
current_time = Time.current
timestamps = { created_at: current_time, updated_at: current_time }
TrainingProvider.reset_column_information
TrainingProvider.upsert(SECUREFLAG_DATA.merge(timestamps))
end
def down
TrainingProvider.reset_column_information
TrainingProvider.find_by(name: SECUREFLAG_DATA[:name])&.destroy
end
end
|