{"id":19658186,"url":"https://github.com/cdaringe/postgraphile-upsert","last_synced_at":"2025-07-24T17:14:53.487Z","repository":{"id":33750872,"uuid":"158751817","full_name":"cdaringe/postgraphile-upsert","owner":"cdaringe","description":"add postgres upsert mutations to postgraphile :elephant:","archived":false,"fork":false,"pushed_at":"2024-08-05T22:07:07.000Z","size":2113,"stargazers_count":31,"open_issues_count":9,"forks_count":20,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T14:46:40.452Z","etag":null,"topics":["mutation","postgraphile","postgres","upsert"],"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/cdaringe.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"2018-11-22T21:30:52.000Z","updated_at":"2024-12-30T22:15:14.000Z","dependencies_parsed_at":"2024-01-09T06:23:38.464Z","dependency_job_id":"82c0789a-a84e-4681-9ecf-0dff00f6659d","html_url":"https://github.com/cdaringe/postgraphile-upsert","commit_stats":{"total_commits":522,"total_committers":12,"mean_commits":43.5,"dds":0.5459770114942528,"last_synced_commit":"73bebdafcdaac5939d13a09c327e2ae400312d27"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fpostgraphile-upsert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fpostgraphile-upsert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fpostgraphile-upsert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdaringe%2Fpostgraphile-upsert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdaringe","download_url":"https://codeload.github.com/cdaringe/postgraphile-upsert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161933,"owners_count":21057674,"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":["mutation","postgraphile","postgres","upsert"],"created_at":"2024-11-11T15:36:23.887Z","updated_at":"2025-04-10T05:25:11.017Z","avatar_url":"https://github.com/cdaringe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgraphile-upsert-plugin\n\nAdd postgres `upsert` mutations to [postgraphile](https://www.graphile.org/postgraphile).\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![main](https://github.com/cdaringe/postgraphile-upsert/actions/workflows/main.yml/badge.svg)](https://github.com/cdaringe/postgraphile-upsert/actions/workflows/main.yml)\n\n## Getting Started\n\n### Install\n\n```bash\npnpm install --save postgraphile-upsert-plugin\n```\n\n### CLI\n\n```bash\npostgraphile --append-plugins postgraphile-upsert-plugin:PgMutationUpsertPlugin\n```\n\nSee [here](https://www.graphile.org/postgraphile/extending/#loading-additional-plugins) for more information about loading plugins with PostGraphile.\n\n### Library\n\n```ts\nimport express from \"express\";\nimport { postgraphile } from \"postgraphile\";\nimport { PgMutationUpsertPlugin } from \"postgraphile-upsert-plugin\";\n\nconst app = express();\n\napp.use(\n  postgraphile(pgConfig, schema, {\n    appendPlugins: [PgMutationUpsertPlugin],\n  })\n);\n\napp.listen(5000);\n```\n\n## Usage\n\nThis plugin supports an optional `where` clause in your `upsert\u003cTable\u003e` mutation. Supports multi-column unique indexes.\n\n## Example\n\n```sql\ncreate table bikes (\n  id serial primary key,\n  make varchar,\n  model varchar\n  serial_number varchar unique not null,\n  weight real\n)\n```\n\nA basic upsert would look like this:\n\n```graphql\nmutation {\n  upsertBike(\n    where: { serial_number: \"abc123\" }\n    input: {\n      bike: {\n        make: \"kona\"\n        model: \"kula deluxe\"\n        serial_number: \"abc123\"\n        weight: 25.6\n      }\n    }\n  ) {\n    clientMutationId\n  }\n}\n```\n\n## [Smart Tags](https://www.graphile.org/postgraphile/smart-tags/) Support\n\n- Add `@omit updateOnConflict` to column comments to prevent them from being modified on _existing_ rows in an upsert mutation.\n\n## Contributing\n\nSee [`CONTRIBUTING.md`](./.github/CONTRIBUTING.md).\n\n## Credits\n\n- This is a typescript-ified knock off of [the original upsert plugin](https://github.com/einarjegorov/graphile-upsert-plugin/blob/master/index.js)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaringe%2Fpostgraphile-upsert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdaringe%2Fpostgraphile-upsert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdaringe%2Fpostgraphile-upsert/lists"}