{"id":27363740,"url":"https://github.com/chriscasola/pgit","last_synced_at":"2026-05-08T13:12:26.474Z","repository":{"id":144204036,"uuid":"103719533","full_name":"chriscasola/pgit","owner":"chriscasola","description":"A database migration tool that lets you keep your schema in git, with the rest of your project.","archived":false,"fork":false,"pushed_at":"2019-02-14T15:51:06.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-14T18:09:24.797Z","etag":null,"topics":["database","database-migrations","git","migration","schema","version-control"],"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/chriscasola.png","metadata":{"files":{"readme":"README.md","changelog":"changeset_file.go","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2017-09-16T02:53:25.000Z","updated_at":"2025-06-13T00:32:28.000Z","dependencies_parsed_at":"2023-06-19T07:58:31.801Z","dependency_job_id":null,"html_url":"https://github.com/chriscasola/pgit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chriscasola/pgit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriscasola%2Fpgit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriscasola%2Fpgit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriscasola%2Fpgit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriscasola%2Fpgit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chriscasola","download_url":"https://codeload.github.com/chriscasola/pgit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chriscasola%2Fpgit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32781815,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"ssl_error","status_checked_at":"2026-05-08T08:22:45.650Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["database","database-migrations","git","migration","schema","version-control"],"created_at":"2025-04-13T04:35:20.876Z","updated_at":"2026-05-08T13:12:26.469Z","avatar_url":"https://github.com/chriscasola.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgit [![CircleCI](https://circleci.com/gh/chriscasola/pgit.svg?style=svg)](https://circleci.com/gh/chriscasola/pgit)\n\nPronounce \"pee-git\" - a database migration tool that lets you keep your schema and migrations in a git repository.\n\n## Roadmap\n- [x] Implement support for the `changeset` file type\n- [x] Implement support for the `definition` file type\n- [x] Build out a CLI\n\n## Installing\n\ngo get github.com/chriscasola/pgit/cmd/pgit\n\n## Usage \n\nWith pgit you should place all of the `.sql` files describing your database and migrations into a single directory\ninside your project (there can be nested directories).\n\nTo perform a migration run `pgit -database \u003cdatabase-connection-string\u003e -root \u003cpath-to-sql-directory\u003e migrate`\n\n### File Types\n\nEach file will have `-- pgit type=\u003csome_type\u003e` on the first line where `\u003csome_type\u003e` is replace with one of the\nsupported file types:\n\n#### changeset\n\nThis type of file is most useful for statements that create tables, modify tables, or similar operations that you want to record as a sequence of steps in your file.\n\n```SQL\n-- pgit type=changeset\n\n-- change\nCREATE TABLE some_table\n(\n    col_a text\n);\n\n-- rollback\nDROP TABLE some_table\n\n-- change\nALTER TABLE some_table ADD COLUMN col_b text;\n\n-- rollback\nALTER TABLE some_table DROP COLUMN col_b;\n```\n\n#### definition\n\nThis type of file is most useful for stored procedures or functions. For this type of file pgit will use the git history to track revisions. You need only keep the most recent version of the definition in the file, along with SQL to rollback that version.\n\n```SQL\n-- pgit type=definition\n\n-- definition\nCREATE FUNCTION do_something(\n    param_a text\n)\nBEGIN\nEND;\n\n-- rollback\nDROP FUNCTION do_something(text);\n```\n\n## Developers\n\nRun tests with `go test`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriscasola%2Fpgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchriscasola%2Fpgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchriscasola%2Fpgit/lists"}