@gallopsystems/agent-skills 1.20.0 → 1.20.1
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.
package/package.json
CHANGED
|
@@ -43,11 +43,27 @@ const upsertedProduct = await db
|
|
|
43
43
|
oc.column("sku").doUpdateSet((eb) => ({
|
|
44
44
|
// Update these columns on conflict - type-safe!
|
|
45
45
|
stock_quantity: eb("product.stock_quantity", "+", eb.ref("excluded.stock_quantity")),
|
|
46
|
+
// Prefer typed builders over raw sql here too: eb.fn.coalesce(...) over both
|
|
47
|
+
// tables validates names against the schema (excluded is a real virtual table)
|
|
48
|
+
name: eb.fn.coalesce(eb.ref("product.name"), eb.ref("excluded.name")),
|
|
46
49
|
}))
|
|
47
50
|
)
|
|
48
51
|
.returning(["id", "sku", "stock_quantity"])
|
|
49
52
|
.executeTakeFirst();
|
|
50
53
|
|
|
54
|
+
// GOTCHA: when you DO need raw sql in a SET / doUpdateSet value (e.g. now()),
|
|
55
|
+
// do NOT parameterize it with a codegen ColumnType marker like the generated
|
|
56
|
+
// `Timestamp` (= ColumnType<Date, ...>). It breaks compilation:
|
|
57
|
+
// updated_at: sql<Timestamp>`now()` // ❌ TS2345: RawBuilder<Timestamp> not
|
|
58
|
+
// // assignable; "isSelectQueryBuilder" missing
|
|
59
|
+
// The SET target is the flattened Updateable value type (e.g. string | Date | undefined),
|
|
60
|
+
// and RawBuilder<ColumnType<...>> falls outside that plain-value branch. Use a plain
|
|
61
|
+
// value type or leave it bare instead:
|
|
62
|
+
// updated_at: sql<Date>`now()` // ✅ Date is a plain value type
|
|
63
|
+
// updated_at: sql`now()` // ✅ also assigns cleanly
|
|
64
|
+
// (The "always type your sql literals" rule is aimed at SELECT, where the type flows
|
|
65
|
+
// into the result. In write contexts, ColumnType markers are the wrong parameter.)
|
|
66
|
+
|
|
51
67
|
// OnConflict variations:
|
|
52
68
|
// - oc.column("col") - single column constraint
|
|
53
69
|
// - oc.columns(["col1", "col2"]) - composite constraint
|