{"id":18431253,"url":"https://github.com/zhan3333/go-migrate","last_synced_at":"2026-05-15T18:32:31.783Z","repository":{"id":102224678,"uuid":"287922479","full_name":"zhan3333/go-migrate","owner":"zhan3333","description":"go-framework gorm migrate module","archived":false,"fork":false,"pushed_at":"2020-12-09T06:35:28.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-22T15:04:58.784Z","etag":null,"topics":["golang","gorm","migrate","mysql"],"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/zhan3333.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}},"created_at":"2020-08-16T10:34:58.000Z","updated_at":"2020-12-09T06:31:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"52004faa-a527-461a-990e-89c3a36a2a40","html_url":"https://github.com/zhan3333/go-migrate","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/zhan3333/go-migrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fgo-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fgo-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fgo-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fgo-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhan3333","download_url":"https://codeload.github.com/zhan3333/go-migrate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhan3333%2Fgo-migrate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33074840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"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":["golang","gorm","migrate","mysql"],"created_at":"2024-11-06T05:24:06.628Z","updated_at":"2026-05-15T18:32:31.766Z","avatar_url":"https://github.com/zhan3333.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-migrate\n\ngo gorm 数据库版本迁移, 支持 MySQL 数据库\n\n## 使用\n\n定义迁移文件\n```go\npackage testdata\n\ntype FooMigrateFile struct {\n}\n\n// 迁移文件标识, 唯一性\nfunc (FooMigrateFile) Key() string {\n\treturn \"FooMigrateFile\"\n}\n\n// 迁移时执行\nfunc (FooMigrateFile) Up(tx *gorm.DB) error {\n\ttx.Exec(\"create table test (id int)\")\n\treturn nil\n}\n\n// 回滚时执行\nfunc (FooMigrateFile) Down(tx *gorm.DB) error {\n\ttx.Exec(\"drop table test\")\n\treturn nil\n}\n\n```\n\n```go\npackage main\n\nimport \"github.com/zhan3333/go-migrate\"\nimport \"github.com/jinzhu/gorm\"\n\nfunc main() {\n    var err error\n    // 初始化数据库连接\n    migrate.DB, err = gorm.Open(\"mysql\", \"\")\n    // 初始化 Migrations table\n    _ = migrate.InitMigrationTable()\n    // 注册迁移文件\n    migrate.Register(\u0026FooMigrateFile{})\n    // 迁移\n    migrate.Migrate(1)\n    // 回滚\n    migrate.Rollback(1)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhan3333%2Fgo-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhan3333%2Fgo-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhan3333%2Fgo-migrate/lists"}