{"id":43169277,"url":"https://github.com/procore-oss/migration-lock-timeout","last_synced_at":"2026-02-01T02:16:05.403Z","repository":{"id":56883709,"uuid":"64318965","full_name":"procore-oss/migration-lock-timeout","owner":"procore-oss","description":"A Ruby gem that adds a lock timeout to Active Record migrations","archived":false,"fork":false,"pushed_at":"2026-01-26T23:29:21.000Z","size":92,"stargazers_count":35,"open_issues_count":5,"forks_count":9,"subscribers_count":166,"default_branch":"main","last_synced_at":"2026-01-27T09:30:37.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/procore-oss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-07-27T15:14:16.000Z","updated_at":"2026-01-12T20:39:07.000Z","dependencies_parsed_at":"2024-08-07T01:46:12.243Z","dependency_job_id":"4d880b9d-e410-4da3-b4b3-ef2487bd80e1","html_url":"https://github.com/procore-oss/migration-lock-timeout","commit_stats":{"total_commits":53,"total_committers":7,"mean_commits":7.571428571428571,"dds":"0.30188679245283023","last_synced_commit":"1ba3f777922059c31d55b3408564de8a30c3315a"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/procore-oss/migration-lock-timeout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/procore-oss%2Fmigration-lock-timeout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/procore-oss%2Fmigration-lock-timeout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/procore-oss%2Fmigration-lock-timeout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/procore-oss%2Fmigration-lock-timeout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/procore-oss","download_url":"https://codeload.github.com/procore-oss/migration-lock-timeout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/procore-oss%2Fmigration-lock-timeout/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28965039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T02:14:24.993Z","status":"ssl_error","status_checked_at":"2026-02-01T02:13:55.706Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-01T02:16:04.726Z","updated_at":"2026-02-01T02:16:05.398Z","avatar_url":"https://github.com/procore-oss.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migration Lock Timeout\n\nMigration Lock Timeout is a Ruby gem that adds a lock timeout to all Active\nRecord migrations in your Ruby on Rails project. A lock timeout sets a timeout\non how long PostgreSQL will wait to acquire a lock on tables being altered\nbefore failing and rolling back. This prevents migrations from creating\nadditional lock contention that can take down your site when it's under heavy\nload. Migration Lock Timeout currently only supports [PostgreSQL](https://www.postgresql.org/)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'migration-lock-timeout'\n```\n\n## Usage\n\nConfigure the default lock timeout in a Rails initializer\n\n```ruby\n#config/initializers/migration_lock_timeout.rb\n\nMigrationLockTimeout.configure do |config|\n  config.default_timeout = 5 #timeout in seconds\nend\n```\n\nAnd that's all! Now every `up` migration will execute\n```psql\nSET LOCAL lock_timeout = '5s';\n```\ninside the migration transaction before your migration code runs. No lock\ntimeout will be used for the `down` migration.\n\n## Disabling\n\nYou can disable the lock timeout by using:\n```ruby\n  class AddFoo \u003c ActiveRecord::Migration\n\n    disable_lock_timeout!\n\n    def change\n      create_table :foo do |t|\n        t.timestamps\n      end\n    end\n  end\n```\n\n## Custom lock timeout\n\nYou can change the duration of the lock timeout by using:\n```ruby\n  class AddBar \u003c ActiveRecord::Migration\n\n    set_lock_timeout 10\n\n    def change\n      create_table :bar do |t|\n        t.timestamps\n      end\n    end\n  end\n```\nAdditionally, if you have not set a default lock timeout, you can use this to\nset a timeout for a particular migration.\n\n## disable_ddl_transaction!\n\nIf you use `disable_ddl_transaction!`, no lock timeout will occur\n```ruby\n  class AddMonkey \u003c ActiveRecord::Migration\n\n    disable_ddl_transaction!\n\n    def change\n      create_table :monkey do |t|\n        t.timestamps\n      end\n    end\n  end\n```\n\n## Running the specs\n\nTo run the specs you must have [PostgreSQL](https://www.postgresql.org/)\ninstalled. Create a database called `migration_lock_timeout_test` and set the\nenvironment variables `POSTGRES_DB_USERNAME` and `POSTGRES_DB_PASSWORD` then run\n`rspec`\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/procore-oss/migration-lock-timeout. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## About Procore\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/procore-oss/.github/blob/main/procoredarklogo.png?raw=true\"\u003e\n  \u003cimg alt=\"Procore Open Source\" src=\"https://raw.githubusercontent.com/procore-oss/.github/main/procorelightlogo.png\"\u003e\n\u003c/picture\u003e\n\nMigration Lock Timeout is maintained by Procore Technologies.\n\nProcore - building the software that builds the world.\n\nLearn more about the #1 most widely used construction management software at [procore.com](https://www.procore.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprocore-oss%2Fmigration-lock-timeout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprocore-oss%2Fmigration-lock-timeout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprocore-oss%2Fmigration-lock-timeout/lists"}