{"id":14974148,"url":"https://github.com/soulman-is-good/pg-git","last_synced_at":"2025-10-27T06:31:58.113Z","repository":{"id":18599645,"uuid":"83727806","full_name":"soulman-is-good/pg-git","owner":"soulman-is-good","description":"PostgreSQL migration/diff/dump simple tool","archived":false,"fork":false,"pushed_at":"2022-12-30T20:24:28.000Z","size":6386,"stargazers_count":3,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T03:22:07.662Z","etag":null,"topics":["apgdiff","diff","migration","nodejs","postgresql","utility"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/soulman-is-good.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-03-02T21:45:38.000Z","updated_at":"2023-12-04T01:07:42.000Z","dependencies_parsed_at":"2023-01-13T19:55:07.349Z","dependency_job_id":null,"html_url":"https://github.com/soulman-is-good/pg-git","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soulman-is-good%2Fpg-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soulman-is-good%2Fpg-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soulman-is-good%2Fpg-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soulman-is-good%2Fpg-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soulman-is-good","download_url":"https://codeload.github.com/soulman-is-good/pg-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238455076,"owners_count":19475374,"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":["apgdiff","diff","migration","nodejs","postgresql","utility"],"created_at":"2024-09-24T13:50:03.075Z","updated_at":"2025-10-27T06:31:52.742Z","avatar_url":"https://github.com/soulman-is-good.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### PostgreSQL simple code dumping tool with diff migration\n\n![travis](https://travis-ci.org/soulman-is-good/pg-git.svg?branch=master) ![npm](https://img.shields.io/npm/v/pg-git?style=plastic) ![types](https://img.shields.io/npm/types/pg-git?style=plastic)\n\n**Best used with git** :octocat:\n\nThis tool was written to help migrate between different servers and to help with distributed development on PostgreSQL.\nTool will automatically download latest Postgres binaries for the platform unless `NO_DOWNLOAD` env or `--no_download` flag is specified.\nElse tool will try to use system default `pg_dump` and `psql` files.\n\nWARNING: This tool uses and bundles:\n\n- [apgdiff](https://github.com/fordfrog/apgdiff) v2.6 jar file (requires Java VM)\n\n**node \u003e=11.0.0**\n\nIf you want to override this to yours binaries, e.g. system defaulted, then use envirnoment variables or cli params described below.\n\n#### Usage\n\nCommonly tool was develop as standalone and to install as dependency to use with npm. But you can also `require`\nit within you project, not much use of it that way though.\n\n```js\nconst { dump, diff, apply, StringStream } = require('pg-git');\n\nconst options = {\n  user: 'postgres',\n  password: 'postgres',\n  database: 'postgres',\n  host: 'localhost',\n  port: 5432,\n  noDownload: true,\n};\nconst newDump = new StringStream('CREATE TABLE public.test(id integer);');\n\n// dump current database, make a diff and apply\ndump(options)\n  .then(dumpStream =\u003e diff(options, dumpStream, newDump))\n  .then(diffStream =\u003e apply(options, diffStream))\n  .catch(console.error);\n```\n\nOr you can install tool globaly (or localy and use with npm run ...)\n\n```\nnpm i -g pg-git\n```\n\nAnd use it in your project\n\nUsage \n\n```\npgit [options] \u003ccommand\u003e\n\nCommands:\n  commit - Create new dump\n  migrate - Make a diff with dump file and apply it to database\n\nOptions:\n  --user \u003cUSERNAME\u003e - database user\n  --password \u003cPASSWORD\u003e - database password\n  --host \u003cHOST\u003e - pg host\n  --port \u003cPORT\u003e - database port\n  --dumpname \u003cdumpname\u003e - dump file name. default: dump.sql\n  --pgversion \u003cversion\u003e - postgres version to use. Specify exact version or only part else latest will be taken. E.g. 10 or 9.5 or 9.4.21\n  --psql \u003cpath\u003e - path to psql binary\n  --pg_dump \u003cpath\u003e - path to pg_dump binary\n  --no_download \u003cany\u003e - do not download binaries from external resource \n```\n\nExample\n\n```\npg-git --user postgres --password postgres --host 127.0.0.1 --port 5432 commit my_database\n```\n\n#### Environment variables\n\n```\nPGUSER - Postgres user\nPGHOST - Postgres host\nPGDATABASE - Postgres database name\nPGPASSWORD - Postgres password for user\nPGVERSION - postgres version to use. Specify exact version or only part else latest will be taken. E.g. 10 or 9.5 or 9.4.21\nPSQL_PATH - Absolute path to your psql binary file\nPG_DUMP_PATH - Absolute path to yout pg_dump binary file\nNO_DOWNLOAD - do not download binaries from external resource\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoulman-is-good%2Fpg-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoulman-is-good%2Fpg-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoulman-is-good%2Fpg-git/lists"}