diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2019-08-24 00:36:12 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-08-24 00:36:12 +0300 |
commit | 4706352416005962ccb34bad1c3acc5d7479523c (patch) | |
tree | 334b873d90bf2aa98349f3812e9b1af06f89f484 /db/migrate/20190711124721_create_job_variables.rb | |
parent | b8dec7ecb43d3825f994136ca68e88aada832218 (diff) |
Adds cop to enforce string limits on migrations
This cop will analyze migrations that add columns with string, and
report an offense if the string has no limit enforced
Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/64505
Diffstat (limited to 'db/migrate/20190711124721_create_job_variables.rb')
-rw-r--r-- | db/migrate/20190711124721_create_job_variables.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/db/migrate/20190711124721_create_job_variables.rb b/db/migrate/20190711124721_create_job_variables.rb index a860522f39e..4ff4b031d8f 100644 --- a/db/migrate/20190711124721_create_job_variables.rb +++ b/db/migrate/20190711124721_create_job_variables.rb @@ -10,6 +10,7 @@ class CreateJobVariables < ActiveRecord::Migration[5.1] DOWNTIME = false def change + # rubocop:disable Migration/AddLimitToStringColumns create_table :ci_job_variables do |t| t.string :key, null: false t.text :encrypted_value @@ -17,6 +18,7 @@ class CreateJobVariables < ActiveRecord::Migration[5.1] t.references :job, null: false, index: true, foreign_key: { to_table: :ci_builds, on_delete: :cascade } t.integer :variable_type, null: false, limit: 2, default: 1 end + # rubocop:enable Migration/AddLimitToStringColumns add_index :ci_job_variables, [:key, :job_id], unique: true end |