From 383883382bac97477eb8448bef3ffac15d7ceacf Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Mon, 8 May 2017 19:15:43 +0200 Subject: 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. --- ...20170508153950_add_not_null_contraints_to_ci_variables.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 db/post_migrate/20170508153950_add_not_null_contraints_to_ci_variables.rb (limited to 'db') 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 -- cgit v1.2.1