{"id":40543434,"url":"https://github.com/i-erokhin/pgx_migrant","last_synced_at":"2026-01-20T23:16:15.499Z","repository":{"id":57714474,"uuid":"139847704","full_name":"i-erokhin/pgx_migrant","owner":"i-erokhin","description":"Golang library for migrations and sync interfaces versions of PostgreSQL databases. pgx driver only.","archived":false,"fork":false,"pushed_at":"2018-07-05T14:29:25.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-21T10:59:14.685Z","etag":null,"topics":["go","golang","migrations","pgx","postgresql"],"latest_commit_sha":null,"homepage":null,"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/i-erokhin.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-07-05T12:40:20.000Z","updated_at":"2018-07-05T14:29:26.000Z","dependencies_parsed_at":"2022-09-26T21:31:26.201Z","dependency_job_id":null,"html_url":"https://github.com/i-erokhin/pgx_migrant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/i-erokhin/pgx_migrant","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-erokhin%2Fpgx_migrant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-erokhin%2Fpgx_migrant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-erokhin%2Fpgx_migrant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-erokhin%2Fpgx_migrant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/i-erokhin","download_url":"https://codeload.github.com/i-erokhin/pgx_migrant/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/i-erokhin%2Fpgx_migrant/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28618797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T22:24:05.405Z","status":"ssl_error","status_checked_at":"2026-01-20T22:20:31.342Z","response_time":117,"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":["go","golang","migrations","pgx","postgresql"],"created_at":"2026-01-20T23:16:14.931Z","updated_at":"2026-01-20T23:16:15.488Z","avatar_url":"https://github.com/i-erokhin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"pgx_migrant\n===========\n\nGolang library for migrations and sync interfaces versions of PostgreSQL databases. pgx driver only.\n\nStatus\n------\n\nIt works, but API is unstable. And docs needed.\n\nUsage Example\n-------------\n\n```go\n\npackage db_sync_helper\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/i-erokhin/pgx_migrant\"\n\t\"github.com/jackc/pgx\"\n\n\t\"giterica.io/project/repo/config\"\n\t\"giterica.io/project/repo/constants\"\n)\n\nfunc DBSyncHelper(c *config.Conf, db *pgx.ConnPool) error {\n\ttx, err := db.Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer tx.Rollback()\n\n\tif err = migrate(c, tx); err != nil {\n\t\treturn err\n\t}\n\n\treturn tx.Commit()\n}\n\nfunc migrate(c *config.Conf, tx *pgx.Tx) error {\n\tsm := migrant.SyncMap{\n\t\tMigration: migrant.MigrationMap{\n\t\t\tPath:   c.SQlArtifacts.MigrationsPath,\n\t\t\tSchema: constants.DBSchema,\n\t\t},\n\t\tInterfaces: migrant.InterfacesMap{\n\t\t\tPath:   c.SQlArtifacts.InterfacesPath,\n\t\t\tSchema: constants.DBInterfacesSchema,\n\t\t},\n\t\tTemplateData: c,\n\t}\n\n\tresult, err := migrant.SyncDB(tx, sm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(result.Migrations.Files) != 0 {\n\t\tfmt.Printf(\"DB state: %d, migrations applied:\\n\", result.Migrations.Number)\n\t\tfor _, name := range result.Migrations.Files {\n\t\t\tfmt.Printf(\"  %s\\n\", name)\n\t\t}\n\t}\n\tif len(result.Interfaces.Files) != 0 {\n\t\tfmt.Printf(\"Actual DB interfaces schema: %s, SQL files applied:\\n\", constants.DBInterfacesSchema)\n\t\tfor _, name := range result.Interfaces.Files {\n\t\t\tfmt.Printf(\"  %s\\n\", name)\n\t\t}\n\t}\n\treturn nil\n}\n```\n\nOutput:\n\n```\nDB state: 2, migrations applied:\n  01-tables.sql\n  02-seeds.sql\nActual DB interfaces schema: tabel_interfaces_0, SQL files applied:\n  01-active_employee.sql\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-erokhin%2Fpgx_migrant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fi-erokhin%2Fpgx_migrant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fi-erokhin%2Fpgx_migrant/lists"}