{"id":24857318,"url":"https://github.com/eezing/sqerge","last_synced_at":"2026-02-04T00:03:27.099Z","repository":{"id":61267413,"uuid":"537864976","full_name":"eezing/sqerge","owner":"eezing","description":"Forward only PostgreSQL migration","archived":false,"fork":false,"pushed_at":"2026-01-18T19:10:13.000Z","size":163,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-19T02:43:35.731Z","etag":null,"topics":["migration","postgres","sql"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/eezing.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}},"created_at":"2022-09-17T16:23:34.000Z","updated_at":"2026-01-18T19:10:16.000Z","dependencies_parsed_at":"2024-05-19T16:37:57.277Z","dependency_job_id":"73cf5154-678e-4ff2-8007-0887ba6e8b74","html_url":"https://github.com/eezing/sqerge","commit_stats":{"total_commits":29,"total_committers":2,"mean_commits":14.5,"dds":0.03448275862068961,"last_synced_commit":"7054cd7dec3d0f1b05e423a11abd68eaa66b1bcc"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/eezing/sqerge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eezing%2Fsqerge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eezing%2Fsqerge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eezing%2Fsqerge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eezing%2Fsqerge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eezing","download_url":"https://codeload.github.com/eezing/sqerge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eezing%2Fsqerge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29062484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"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":["migration","postgres","sql"],"created_at":"2025-01-31T17:52:55.384Z","updated_at":"2026-02-04T00:03:27.082Z","avatar_url":"https://github.com/eezing.png","language":"TypeScript","readme":"# sqerge\n\nA forward only PostgreSQL migration tool. Uses [Postgres.js](https://github.com/porsager/postgres) library under the hood.\n\n## Get Started\n\n1. Install NPM package\n\n   ```sh\n   npm i sqerge -D\n   ```\n\n2. Install Postgres.js (may install as peerDependency automatically on NPM v7+)\n\n   ```sh\n   npm i postgres\n   ```\n\n3. Choose a migration directory\n   ```sh\n   mkdir foo\n   ```\n4. Create some migration files\n\n   The filename **prefix** represents the execution order, a unique integer followed by a hyphen. After the hyphen, it's all yours. Files not matching the prefix are ignored.\n\n   ```sql\n   -- file: ./foo/1-bar.sql\n\n   CREATE TABLE person (\n     \"id\" SERIAL PRIMARY KEY,\n     \"name\" text NOT NULL\n   );\n   ```\n\n   ```sql\n   -- file: ./foo/2-biz.sql\n\n   ALTER TABLE person\n     ADD COLUMN \"age\" smallint;\n   ```\n\n   In addition to **.sql**, migration files can also end in **.js** or **.mjs** for ES Modules. JavaScript files must **default export a function**. The 1st argument is a [Postgres.js](https://github.com/porsager/postgres) instance.\n\n   ```js\n   // file: ./foo/3-baz.js\n\n   module.exports = async (sql) =\u003e {\n     await sql`\n       INSERT INTO person\n         (\"name\", \"age\")\n       VALUES\n         ('Luke Skywalker', '21');\n     `;\n   };\n   ```\n\n5. Execute migration\n\n   Command:\n\n   ```sh\n   PGHOST=localhost PGPORT=5438 PGUSER=jonathan PGPASSWORD=iliketurtles PGDATABASE=dev npx sqerge ./foo\n   ```\n\n   Output:\n\n   ```sh\n   [sqerge] 3 file(s) found in '/Users/jonathan/Desktop/foo'\n   [sqerge] file 1 (1-bar.sql): executed\n   [sqerge] file 2 (2-biz.sql): executed\n   [sqerge] file 3 (3-baz.js): executed\n   ```\n\n## Environment Variables\n\n- Use **Postgres.js** [environment variables](https://github.com/porsager/postgres#environmental-variables) for your database **connection**.\n\n- **ROLE** (optional)\n\n  Execute migration with the specified database role. This is helpful for when your `LOGIN` role has a `NOINHERIT` membership to another role containting privileges required for your migration. If ROLE is provided, sqerge will execute `SET ROLE` for the session and then execute your migration files.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feezing%2Fsqerge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feezing%2Fsqerge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feezing%2Fsqerge/lists"}