Fix account counters being overwritten by parallel writes (#12045)
This commit is contained in:
parent
9e3e3fa5ee
commit
62f60e86c2
4 changed files with 92 additions and 1 deletions
|
@ -0,0 +1,15 @@
|
|||
require Rails.root.join('lib', 'mastodon', 'migration_helpers')
|
||||
|
||||
class AddLockVersionToAccountStats < ActiveRecord::Migration[5.2]
|
||||
include Mastodon::MigrationHelpers
|
||||
|
||||
disable_ddl_transaction!
|
||||
|
||||
def up
|
||||
safety_assured { add_column_with_default :account_stats, :lock_version, :integer, allow_null: false, default: 0 }
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :account_stats, :lock_version
|
||||
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_09_27_232842) do
|
||||
ActiveRecord::Schema.define(version: 2019_10_01_213028) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -97,6 +97,7 @@ ActiveRecord::Schema.define(version: 2019_09_27_232842) do
|
|||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "last_status_at"
|
||||
t.integer "lock_version", default: 0, null: false
|
||||
t.index ["account_id"], name: "index_account_stats_on_account_id", unique: true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue