{"id":15178909,"url":"https://github.com/raph6/migration","last_synced_at":"2026-02-25T07:41:55.414Z","repository":{"id":181606605,"uuid":"592884614","full_name":"raph6/migration","owner":"raph6","description":"db migrations in golang","archived":false,"fork":false,"pushed_at":"2025-11-02T23:18:06.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-03T01:11:51.655Z","etag":null,"topics":["database","migration","migration-tool","migrations","mysql","pgx","phinx","postgresql","sqlite","sqlite3","sqlx"],"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/raph6.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,"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":"2023-01-24T18:39:06.000Z","updated_at":"2025-11-02T23:17:44.000Z","dependencies_parsed_at":"2024-04-30T11:42:00.355Z","dependency_job_id":"bd327074-3b9f-4d93-b6d5-4a37ef8d48df","html_url":"https://github.com/raph6/migration","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":0.2272727272727273,"last_synced_commit":"bb481a2cd37fa269bce88c77a5eed221d8626ed3"},"previous_names":["raph6/migration"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/raph6/migration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raph6%2Fmigration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raph6%2Fmigration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raph6%2Fmigration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raph6%2Fmigration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raph6","download_url":"https://codeload.github.com/raph6/migration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raph6%2Fmigration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29814269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T05:36:42.804Z","status":"ssl_error","status_checked_at":"2026-02-25T05:36:31.934Z","response_time":61,"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":["database","migration","migration-tool","migrations","mysql","pgx","phinx","postgresql","sqlite","sqlite3","sqlx"],"created_at":"2024-09-27T15:41:47.649Z","updated_at":"2026-02-25T07:41:55.380Z","avatar_url":"https://github.com/raph6.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migration for Golang\nCurrently only works with `github.com/jmoiron/sqlx`.\n\n## How to use\nInstall : `go get -u github.com/raph6/migration`\n\nCreate a `migrations` folder in the root of the project and upload your `.sql` files as `ID_name_of_migration.sql`.\n\nExample: `10001_create_accounts_table.sql`\n\nCan contain several SQL queries such as :\n```sql\n-- 10001_create_accounts_table.sql\nCREATE TABLE `accounts` (\n    `id` INT AUTO_INCREMENT PRIMARY KEY,\n    `username` VARCHAR(255) NOT NULL,\n    `password` VARCHAR(255) NOT NULL\n);\n```\n\n```sql\n-- 10002_add_admin_to_accounts_table.sql\nALTER TABLE `accounts` ADD COLUMN `secret_token` varchar(200) DEFAULT NULL;\n\nALTER TABLE `accounts` ADD COLUMN `admin` TINYINT(1) NOT NULL DEFAULT 0;\n```\n\nPlease note, do not set file IDs to 1, 2, 3... 10, 11, 12, otherwise files 10, 11, 12 will be read before 1, 2, 3.\n\nI advise you to start at 10000 and then increment or take the timestamp of the file creation.\n\n## Run\n```go\nimport \"github.com/raph6/migration\"\n\nfunc main() {\n    var db *sqlx.DB\n    db = ...\n\n    migration.Migrate(db)\n}\n```\n\n## Incoming\n- [ ] Migration revert\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraph6%2Fmigration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraph6%2Fmigration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraph6%2Fmigration/lists"}