@arcote.tech/arc-adapter-db-postgres 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +13 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5612,11 +5612,19 @@ class PostgreSQLReadWriteTransaction extends PostgreSQLReadTransaction {
5612
5612
  if (!table) {
5613
5613
  throw new Error(`Store ${store} not found`);
5614
5614
  }
5615
- const query = `UPDATE "${table.name}" SET "deleted" = $1, "lastUpdate" = $2 WHERE "${table.primaryKey}" = $3`;
5616
- this.queries.push({
5617
- sql: query,
5618
- params: [true, new Date().toISOString(), id2]
5619
- });
5615
+ if (this.adapter.hasSoftDelete(store)) {
5616
+ const query = `UPDATE "${table.name}" SET "deleted" = $1, "lastUpdate" = $2 WHERE "${table.primaryKey}" = $3`;
5617
+ this.queries.push({
5618
+ sql: query,
5619
+ params: [true, new Date().toISOString(), id2]
5620
+ });
5621
+ } else {
5622
+ const query = `DELETE FROM "${table.name}" WHERE "${table.primaryKey}" = $1`;
5623
+ this.queries.push({
5624
+ sql: query,
5625
+ params: [id2]
5626
+ });
5627
+ }
5620
5628
  }
5621
5629
  async set(store, item) {
5622
5630
  const table = this.tables.get(store);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcote.tech/arc-adapter-db-postgres",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",