{"id":15493993,"url":"https://github.com/noonat/migrate","last_synced_at":"2026-04-09T09:37:07.895Z","repository":{"id":57610334,"uuid":"146680390","full_name":"noonat/migrate","owner":"noonat","description":"A simple migration helper for Go's database/sql package.","archived":false,"fork":false,"pushed_at":"2018-08-30T01:59:15.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-19T11:30:37.933Z","etag":null,"topics":["database","golang","migrations","mysql","postgres","postgresql","sql","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Go","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/noonat.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":"2018-08-30T01:43:23.000Z","updated_at":"2019-05-09T05:06:00.000Z","dependencies_parsed_at":"2022-09-26T20:02:11.696Z","dependency_job_id":null,"html_url":"https://github.com/noonat/migrate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noonat%2Fmigrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noonat%2Fmigrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noonat%2Fmigrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noonat%2Fmigrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noonat","download_url":"https://codeload.github.com/noonat/migrate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246068302,"owners_count":20718503,"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","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","migrations","mysql","postgres","postgresql","sql","sqlite"],"created_at":"2024-10-02T08:10:22.369Z","updated_at":"2025-12-30T23:20:05.089Z","avatar_url":"https://github.com/noonat.png","language":"Go","readme":"# migrate\n\n[![godoc](https://godoc.org/github.com/noonat/migrate?status.svg)][godoc]\n[![travis](https://travis-ci.org/noonat/migrate.svg)][travis]\n[![report](https://goreportcard.com/badge/github.com/noonat/migrate)][report]\n\nPackage migrate provides helpers for running SQL database migrations. It's\ndesigned for migrations that are specified in code and distributed as part\nof the application binary, and applied as part of the application startup\n(rather than via external files and an external tool).\n\n## Usage\n\nYou can read the [package documentation][godoc] for more information, but here\nis a simple example:\n\n```go\nadapter := migrate.NewPostgreSQLAdapter(log.Printf)\ndb, err := sql.Open(\"migrate_test\", \"\")\nif err != nil {\n    log.Panic(err)\n}\n\nmigrations := []migrate.Migration{\n    {\n        Comment: \"Add user and app tables\",\n        Up: migrate.ExecQueries([]string{\n            `CREATE TABLE users (\n                id SERIAL PRIMARY KEY,\n                username VARCHAR(50) NOT NULL)`,\n            `CREATE TABLE apps (\n                id SERIAL PRIMARY KEY,\n                title VARCHAR(100) NOT NULL)`,\n        }),\n        Down: migrate.ExecQueries([]string{\n            `DROP TABLE apps`,\n            `DROP TABLE users`,\n        }),\n    },\n    {\n        Comment: \"Add user app join table\",\n        Up: migrate.ExecQueries([]string{\n            `CREATE TABLE user_apps (\n                user_id INT NOT NULL REFERENCES users(id),\n                app_id INT NOT NULL REFERENCES apps(id),\n                UNIQUE (user_id, app_id))`,\n        }),\n        Down: migrate.ExecQueries([]string{\n            `DROP TABLE user_apps`,\n        }),\n    },\n}\n\nerr = migrate.Up(context.Background(), db, adapter, migrations)\nif err != nil {\n    log.Panicf(\"error running migrations: %s\", err)\n}\n```\n\n## License\n\nMIT\n\n[travis]: https://travis-ci.org/noonat/migrate\n[report]: https://goreportcard.com/report/github.com/noonat/migrate\n[godoc]: https://godoc.org/github.com/noonat/migrate\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoonat%2Fmigrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoonat%2Fmigrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoonat%2Fmigrate/lists"}