summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZ.J. van de Weg <git@zjvandeweg.nl>2017-05-08 19:15:43 +0200
committerZ.J. van de Weg <git@zjvandeweg.nl>2017-05-11 13:17:47 +0200
commit383883382bac97477eb8448bef3ffac15d7ceacf (patch)
treeb2ef6d0ebb6a18da61114526b49bb36f19bace5c
parent1ccf101eef7db401317838a453795fa1c28ec036 (diff)
downloadgitlab-ce-383883382bac97477eb8448bef3ffac15d7ceacf.tar.gz
Prevent NULL values on ci_variables columns
To be more specific; key, and project_id. If either of these is NULL its wrong, because: 1. storing a key value pair without key is just plain wrong 2. all variables should belong to a project Non of these cases existed on the staging database.
-rw-r--r--db/post_migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/db/post_migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb b/db/post_migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb
new file mode 100644
index 00000000000..41c687a4f6e
--- /dev/null
+++ b/db/post_migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb
@@ -0,0 +1,12 @@
+class AddNotNullContraintsToCiVariables < ActiveRecord::Migration
+ DOWNTIME = false
+
+ def up
+ change_column(:ci_variables, :key, :string, null: false)
+ change_column(:ci_variables, :project_id, :integer, null: false)
+ end
+
+ def down
+ # no op
+ end
+end