summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-09-20 17:07:56 -0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:24 -0200
commitcfedd42badc6b84457d1de35cb31988777462d5a (patch)
treeca0588b33e11d2f28104b320dcec6884ac148ec8 /db
parente2dd75c0a2d863c8e530e54f3a0a015bdec1e84f (diff)
downloadgitlab-ce-cfedd42badc6b84457d1de35cb31988777462d5a.tar.gz
Add ProjectLabel model
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160920191518_set_project_label_type_on_labels.rb17
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