Commit 7bd832c9 authored by 2458773093's avatar 2458773093

better migrations for unread count field on group accounts table

parent 06e1c47f
class AddUnreadCountToGroupAccounts < ActiveRecord::Migration[5.2]
def change
add_column :group_accounts, :unread_count, :integer, default: 0
def up
add_column :group_accounts, :unread_count, :integer
change_column_default :group_accounts, :unread_count, 0
end
def down
remove_column :group_accounts, :unread_count
end
end
class BackfillAddUnreadCountToGroupAccounts < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def change
GroupAccount.in_batches do |relation|
relation.update_all unread_count: 0
sleep(0.1)
end
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_07_21_214831) do
ActiveRecord::Schema.define(version: 2019_07_21_234917) do
# These are extensions that must be enabled in order to support this database
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