Commit 11a964ce authored by Stan Hu's avatar Stan Hu

Add separate post migration to change default of notified_of_own_activity

parent 9b475bcc
...@@ -5,7 +5,7 @@ class ReaddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration ...@@ -5,7 +5,7 @@ class ReaddNotifiedOfOwnActivityToUsers < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
def up def up
add_column_with_default :users, :notified_of_own_activity, :boolean, default: false add_column :users, :notified_of_own_activity, :boolean
end end
def down def down
......
class AddNotifiedOfOwnActivityDefault < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
DOWNTIME = false
def up
begin
update_column_in_batches(:users, :notified_of_own_activity, false) do |table, query|
query.where(table[:notified_of_own_activity].eq(nil))
end
change_column :users, :notified_of_own_activity, :boolean, default: false, null: false
end
end
def down
change_column_default :users, :notified_of_own_activity, nil
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170316061730) do ActiveRecord::Schema.define(version: 20170317131326) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment