{"id":15902886,"url":"https://github.com/erikh/migrator","last_synced_at":"2025-08-02T21:34:16.730Z","repository":{"id":57492081,"uuid":"151815945","full_name":"erikh/migrator","owner":"erikh","description":"Simple, efficient PostgreSQL Database migration tool","archived":false,"fork":false,"pushed_at":"2021-04-13T22:59:39.000Z","size":1134,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-20T12:24:40.322Z","etag":null,"topics":["database","golang","migration","postgres"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-06T07:33:52.000Z","updated_at":"2021-04-13T22:59:41.000Z","dependencies_parsed_at":"2022-08-28T11:50:33.282Z","dependency_job_id":null,"html_url":"https://github.com/erikh/migrator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erikh/migrator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikh%2Fmigrator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikh%2Fmigrator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikh%2Fmigrator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikh%2Fmigrator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikh","download_url":"https://codeload.github.com/erikh/migrator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikh%2Fmigrator/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268456833,"owners_count":24253294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"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":["database","golang","migration","postgres"],"created_at":"2024-10-06T12:00:28.790Z","updated_at":"2025-08-02T21:34:16.687Z","avatar_url":"https://github.com/erikh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# migrator: migrate SQL databases with the power of... SQL\n\n[![Build Status](https://travis-ci.org/erikh/migrator.svg?branch=master)](https://travis-ci.org/erikh/migrator)\u003cPaste\u003e\n\nmigrator takes a different approach to many schema migration systems that exist\nalready: it hands you the gun. migrator applies SQL directly to your database\nin a given order determined by the integers in the filename (minus the `.sql` \nextension) in a provided directory. It is formed from years of experience and\nlessons learned writing and using these dumb tools.\n\nmigrator has no notion of a \"down\" migration. This probably isn't changing. If\nyou wish to alter the tables to an older version of the schema, we strongly\nsuggest writing a future migration which will transform your data back, because\nthat is a hell of a lot smarter.\n\n## Example\n\nFor example, your database must **already be created**, and your dir should\nlook like this:\n\n```\ndir/\n  0.sql\n  1.sql\n  2.sql\n```\n\nThe `.sql` files contain arbitrary SQL, but is intended to result in a DDL\ntransaction where tables are modified, indexes etc. You can use as advanced SQL\nas you like and as many statements. Nothing is done with set results, so make\nsure they apply to where you want them to!\n\nWhen finished migrating this directory, your schema version would be `3`. This\nwill carry over to the next run by way of a table we create called\n`schema_migrations` to avoid applying those migrations.\n\nTo apply new migrations, simply run the run the migrator against the same\ndirectory with newer migrations:\n\n```\ndir/\n  0.sql\n  1.sql\n  2.sql\n  3.sql\n  4.sql\n```\n\nIn this case, if you already migrated up to `2` you will migrate next to `3`\nand `4`. Your schema version will be `5` after this.\n\n### More Examples\n\nTry:\n\n* Download the repository and make sure docker is installed\n* Run `make shell`. https://github.com/box-builder/box will be installed, an\n  image will be built and a container will be launched for that image with your\n  `$GOPATH` mounted.\n* `createdb one` at the shell. This will create a database in postgres called\n  `one`.\n* `migrator testdata/one` will apply all the migrations for our first test into\n  the `one` database.\n* If you want different db, or user, etc; check out the flags! `migrator\n  --help`.\n\n## License\n\nCopyright 2018 Erik Hollensbe\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n## Author\n\nErik Hollensbe \u003ch-e@hollensbe.org\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikh%2Fmigrator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikh%2Fmigrator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikh%2Fmigrator/lists"}