{"id":37116441,"url":"https://github.com/heetch/migrate","last_synced_at":"2026-01-14T13:39:08.457Z","repository":{"id":36069088,"uuid":"40368417","full_name":"heetch/migrate","owner":"heetch","description":"Database migration handling in Golang","archived":true,"fork":true,"pushed_at":"2015-08-14T14:19:02.000Z","size":312,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-06-21T12:51:03.249Z","etag":null,"topics":["deprecated","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mattes/migrate","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heetch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-07T15:53:57.000Z","updated_at":"2024-06-21T12:51:03.250Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/heetch/migrate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/heetch/migrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heetch%2Fmigrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heetch%2Fmigrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heetch%2Fmigrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heetch%2Fmigrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heetch","download_url":"https://codeload.github.com/heetch/migrate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heetch%2Fmigrate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28421467,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["deprecated","go"],"created_at":"2026-01-14T13:39:07.934Z","updated_at":"2026-01-14T13:39:08.449Z","avatar_url":"https://github.com/heetch.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# migrate\n\nA migration helper written in Go. Use it in your existing Golang code\nor run commands via the CLI.\n\n```\nGoCode   import github.com/heetch/migrate/migrate\nCLI      go get -u github.com/heetch/migrate\n```\n\n__Features__\n\n* Super easy to implement [Driver interface](http://godoc.org/github.com/heetch/migrate/driver#Driver).\n* Gracefully quit running migrations on ``^C``.\n* No magic search paths routines, no hard-coded config files.\n* CLI is build on top of the ``migrate package``.\n\n\n## Available Drivers\n\n * [PostgreSQL](https://github.com/heetch/migrate/tree/master/driver/postgres)\n * [Cassandra](https://github.com/heetch/migrate/tree/master/driver/cassandra)\n * [SQLite](https://github.com/heetch/migrate/tree/master/driver/sqlite3)\n * [MySQL](https://github.com/heetch/migrate/tree/master/driver/mysql) ([experimental](https://github.com/heetch/migrate/issues/1#issuecomment-58728186))\n * Bash (planned)\n\nNeed another driver? Just implement the [Driver interface](http://godoc.org/github.com/heetch/migrate/driver#Driver) and open a PR.\n\n\n## Usage from Terminal\n\n```bash\n# install\ngo get github.com/heetch/migrate\n\n# create new migration file in path\nmigrate -url driver://url -path ./migrations create migration_file_xyz\n\n# apply all available migrations\nmigrate -url driver://url -path ./migrations up\n\n# roll back all migrations\nmigrate -url driver://url -path ./migrations down\n\n# roll back the most recently applied migration, then run it again.\nmigrate -url driver://url -path ./migrations redo\n\n# run down and then up command\nmigrate -url driver://url -path ./migrations reset\n\n# show the current migration version\nmigrate -url driver://url -path ./migrations version\n\n# apply the next n migrations\nmigrate -url driver://url -path ./migrations migrate +1\nmigrate -url driver://url -path ./migrations migrate +2\nmigrate -url driver://url -path ./migrations migrate +n\n\n# roll back the previous n migrations\nmigrate -url driver://url -path ./migrations migrate -1\nmigrate -url driver://url -path ./migrations migrate -2\nmigrate -url driver://url -path ./migrations migrate -n\n\n# go to specific migration\nmigrate -url driver://url -path ./migrations goto 1\nmigrate -url driver://url -path ./migrations goto 10\nmigrate -url driver://url -path ./migrations goto v\n```\n\n\n## Usage in Go\n\nSee GoDoc here: http://godoc.org/github.com/heetch/migrate/migrate\n\n```go\nimport \"github.com/heetch/migrate/migrate\"\n\n// use synchronous versions of migration functions ...\nallErrors, ok := migrate.UpSync(\"driver://url\", \"./path\")\nif !ok {\n  fmt.Println(\"Oh no ...\")\n  // do sth with allErrors slice\n}\n\n// use the asynchronous version of migration functions ...\npipe := migrate.NewPipe()\ngo migrate.Up(pipe, \"driver://url\", \"./path\")\n// pipe is basically just a channel\n// write your own channel listener. see writePipe() in main.go as an example.\n```\n\n## Migration files\n\nThe format of migration files looks like this:\n\n```\n001_initial_plan_to_do_sth.up.sql     # up migration instructions\n001_initial_plan_to_do_sth.down.sql   # down migration instructions\n002_xxx.up.sql\n002_xxx.down.sql\n...\n```\n\nWhy two files? This way you could still do sth like\n``psql -f ./db/migrations/001_initial_plan_to_do_sth.up.sql`` and there is no\nneed for any custom markup language to divide up and down migrations. Please note\nthat the filename extension depends on the driver.\n\n\n## Alternatives\n\n * https://bitbucket.org/liamstask/goose\n * https://github.com/tanel/dbmigrate\n * https://github.com/BurntSushi/migration\n * https://github.com/DavidHuie/gomigrate\n * https://github.com/rubenv/sql-migrate\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheetch%2Fmigrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheetch%2Fmigrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheetch%2Fmigrate/lists"}