Upsert anything to PostgreSQL
Insert or update provided JSON array (or file with JSON array) to database. Conflicts would be resolved
by column_to_match
- name: Upsert
id: upsert
uses: yakubique/upsert-postgresql@v1.3
with:
input: |
[{ "id": 1, "value": "c", "test": 1 }, { "id": 2, "value": "b", "test": 2 }]
host: ${{ env.PG_HOST }}
port: ${{ env.PG_PORT }}
username: ${{ env.PG_USER }}
password: ${{ env.PG_PWD }}
db: ${{ env.PG_DB }}
ssl: 'false'
column_to_match: 'id'
table_name: 'test'
INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
---|---|---|---|---|
input | string | true | Input JSON/file | |
db | string | true | PostgreSQL db | |
host | string | true | PostgreSQL host | |
password | string | true | PostgreSQL password | |
username | string | true | PostgreSQL username | |
port | string | true | "5432" |
PostgreSQL port (default: 5432) |
table_name | string | true | Name of table to upsert | |
column_to_match | string | true | Primary column to match records (possible to pass multiple columns, comma separated) | |
table_schema | string | false | "public" |
Table schema to upsert (default: 'public') |
ssl | string | false | "true" |
SSL enabled (default: 'true') |
to_file | string | false | "false" |
Save result to file (default: 'false') |
from_file | string | false | "false" |
Read query from file (default: 'false') |
OUTPUT | TYPE | DESCRIPTION |
---|---|---|
count | string | Upserted rows count |