method
with_advisory_lock
v5.0.0.1 -
Show latest stable
- Class:
ActiveRecord::Migrator
with_advisory_lock()private
No documentation available.
# File activerecord/lib/active_record/migration.rb, line 1293
def with_advisory_lock
lock_id = generate_migrator_advisory_lock_id
got_lock = Base.connection.get_advisory_lock(lock_id)
raise ConcurrentMigrationError unless got_lock
load_migrated # reload schema_migrations to be sure it wasn't changed by another process before we got the lock
yield
ensure
Base.connection.release_advisory_lock(lock_id) if got_lock
end