{"id":16696087,"url":"https://github.com/clord/regrate","last_synced_at":"2026-02-18T02:03:40.372Z","repository":{"id":57659479,"uuid":"444606352","full_name":"clord/regrate","owner":"clord","description":"keep track of migrations and get merge conflicts when two people add migrations at the same time","archived":false,"fork":false,"pushed_at":"2024-09-17T19:34:08.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-25T23:27:08.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clord.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"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":"2022-01-05T00:27:06.000Z","updated_at":"2024-09-17T19:34:13.000Z","dependencies_parsed_at":"2025-10-16T12:36:45.268Z","dependency_job_id":"0cc4523d-fb4a-4b42-9292-570206393553","html_url":"https://github.com/clord/regrate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/clord/regrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clord%2Fregrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clord%2Fregrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clord%2Fregrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clord%2Fregrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clord","download_url":"https://codeload.github.com/clord/regrate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clord%2Fregrate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29566366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T00:47:08.760Z","status":"online","status_checked_at":"2026-02-18T02:00:09.468Z","response_time":162,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-10-12T17:25:56.012Z","updated_at":"2026-02-18T02:03:40.345Z","avatar_url":"https://github.com/clord.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Regrate migration management\n\n## Introduction\n\nManage migrations, apply them in order, deal with merge conflicts.\n\n    # create a new shell-based migration\n    regrate init shell\n\n    # Edit the up and down scripts (bash since --shell was used)\n    edit regrate/current/up.sh\n    edit regrate/current/down.sh\n\n    # Run migrations (including current) by executing them in order:\n    regrate run --current {up}\n\n    # You can run any old command and do substitution:\n    regrate run --current echo {name}\n\n    # if your migrations are in SQL files, you might want to pass those to a command:\n    regrate run sqlite3 {up}\n\n    # Once the migration is working right, we can commit it\n    regrate commit -m \"add two columns\"\n\n    # With our migrations complete, we can push it up!\n    git add -A \u0026\u0026 git commit -m \"initial migration\"\n\n    # Try to push it. first rebase onto current...\n    git rebase main ## ERROR, conflicts!\n\n    # Someone else already pushed a migration.\n    # move your local changes to a new migration and try again.\n    # in future we will have a command that resolves conflicts\n    # regrate resolve\n    # regrate-resolve moves your local changes into a new migration, \n    # leaving your peer's as the base.\n\nIn summary,\nif anyone claims the next migration name\nyou get a merge conflict with their change.\nRegrate can help resolve your conflict markers into a new migration.\n\nYour scripts should be idempotent as they will be executed in order\nfrom the start every time.\nThe current runtime version is not tracked by regrate.\nTo help, `regrate-run` will set `REGRATE_INDEX` for each step of the migration,\nwhich can help with keeping track of whether a given script should run in a stateful\nenvironment (on completion, script would update a shared variable to `REGRATE_INDEX`).\n\n`regrate` will derive names from the contents of the migration scripts.\nThis means migration scripts are no longer editable once committed. `regrate-valid`\nwill complain about hash mismatches.\nThis can be used in a pre-commit hook to detect bad changes.\n\nAlso provided is a library that can be used to iterate migrations\nin the current directory. This is helpful for runtime. In this case,\nit is your responsibility to invoke the scripts as you see fit.\nPackages for other languages also exist and let you run migrations.\n\n[![Crates.io](https://img.shields.io/crates/v/regrate.svg)](https://crates.io/crates/regrate)\n[![Docs.rs](https://docs.rs/regrate/badge.svg)](https://docs.rs/regrate)\n[![CI](https://github.com/clord/regrate/workflows/CI/badge.svg)](https://github.com/clord/regrate/actions)\n[![Coverage Status](https://coveralls.io/repos/github/clord/regrate/badge.svg?branch=main)](https://coveralls.io/github/clord/regrate?branch=main)\n\n## Installation\n\n### Cargo\n\n* Install the rust toolchain in order to have cargo installed by following\n  [this](https://www.rust-lang.org/tools/install) guide.\n* Run `cargo install regrate`\n\n## How it works\n\nThe \"current version\" is left open.\nYou can make changes to it,\nand its name is always well known.\nIf two people try to change the open version, it will be a merge conflict.\nTo compute the next version from the current version, take the current version string,\ncompute the hash of all migration scripts in that version,\nand concatenate the version and the hash.\nHash the result and this is your next version name.\nThis sequence can be repeated to generate a list of names.\n\n## License\n\nLicensed under either of\n\n* Apache License, Version 2.0\n   ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license\n   ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclord%2Fregrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclord%2Fregrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclord%2Fregrate/lists"}