diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-20 17:07:56 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 14:58:24 -0200 |
commit | cfedd42badc6b84457d1de35cb31988777462d5a (patch) | |
tree | ca0588b33e11d2f28104b320dcec6884ac148ec8 /db/migrate | |
parent | e2dd75c0a2d863c8e530e54f3a0a015bdec1e84f (diff) | |
download | gitlab-ce-cfedd42badc6b84457d1de35cb31988777462d5a.tar.gz |
Add ProjectLabel model
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20160920191518_set_project_label_type_on_labels.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/migrate/20160920191518_set_project_label_type_on_labels.rb b/db/migrate/20160920191518_set_project_label_type_on_labels.rb new file mode 100644 index 00000000000..af47d0320e2 --- /dev/null +++ b/db/migrate/20160920191518_set_project_label_type_on_labels.rb @@ -0,0 +1,17 @@ +class SetProjectLabelTypeOnLabels < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + update_column_in_batches(:labels, :type, 'ProjectLabel') do |table, query| + query.where(table[:project_id].not_eq(nil)) + end + end + + def down + update_column_in_batches(:labels, :type, nil) do |table, query| + query.where(table[:project_id].not_eq(nil)) + end + end +end |