Repository: ponder-sh/ponder
Pull request #1245 (2024-11-15 16:47:51)

fix: default columns


Patch:
diff --git a/.changeset/long-queens-end.md b/.changeset/long-queens-end.md
new file mode 100644
index 00000000..fa6511a6
--- /dev/null
+++ b/.changeset/long-queens-end.md
@@ -0,0 +1,5 @@
+---
+"@ponder/core": patch
+---
+
+Fixed `onchainSchema`.
diff --git a/.changeset/sharp-news-exist.md b/.changeset/sharp-news-exist.md
new file mode 100644
index 00000000..05ba43cb
--- /dev/null
+++ b/.changeset/sharp-news-exist.md
@@ -0,0 +1,5 @@
+---
+"@ponder/core": patch
+---
+
+Fixed a bug with database instance id.
diff --git a/.changeset/warm-snails-mix.md b/.changeset/warm-snails-mix.md
new file mode 100644
index 00000000..9bda23f7
--- /dev/null
+++ b/.changeset/warm-snails-mix.md
@@ -0,0 +1,5 @@
+---
+"@ponder/core": patch
+---
+
+Fixed a bug with the `.default()` column modifier causing the value to be undefined.
diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md
index ba44f910..23b1e340 100644
--- a/packages/core/CHANGELOG.md
+++ b/packages/core/CHANGELOG.md
@@ -1,13 +1,5 @@
 # @ponder/core
 
-## 0.7.2
-
-### Patch Changes
-
-- [#1243](https://github.com/ponder-sh/ponder/pull/1243) [`2cf9d8d45a688039c186884ff5dd97aa3fd5c7ae`](https://github.com/ponder-sh/ponder/commit/2cf9d8d45a688039c186884ff5dd97aa3fd5c7ae) Thanks [@kyscott18](https://github.com/kyscott18)! - Fixed `onchainSchema`.
-
-- [#1242](https://github.com/ponder-sh/ponder/pull/1242) [`26edcd1c66741288fcce9600769bc27268c50e9e`](https://github.com/ponder-sh/ponder/commit/26edcd1c66741288fcce9600769bc27268c50e9e) Thanks [@jaylmiller](https://github.com/jaylmiller)! - Fixed a bug with database instance id.
-
 ## 0.7.1
 
 ### Patch Changes
diff --git a/packages/core/package.json b/packages/core/package.json
index 5691716f..227ba312 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@ponder/core",
-  "version": "0.7.2",
+  "version": "0.7.1",
   "description": "An open-source framework for crypto application backends",
   "license": "MIT",
   "type": "module",
diff --git a/packages/core/src/indexing-store/historical.ts b/packages/core/src/indexing-store/historical.ts
index f11a6534..ee8b9792 100644
--- a/packages/core/src/indexing-store/historical.ts
+++ b/packages/core/src/indexing-store/historical.ts
@@ -216,9 +216,9 @@ export const createHistoricalIndexingStore = ({
     if (type === EntryType.UPDATE && column.onUpdateFn) {
       return column.onUpdateFn();
     }
-    if (column.default) return column.default;
-    if (column.defaultFn) return column.defaultFn();
-    if (column.onUpdateFn) return column.onUpdateFn();
+    if (column.default !== undefined) return column.default;
+    if (column.defaultFn !== undefined) return column.defaultFn();
+    if (column.onUpdateFn !== undefined) return column.onUpdateFn();
 
     // TODO(kyle) is it an invariant that it doesn't get here
 
diff --git a/packages/create-ponder/CHANGELOG.md b/packages/create-ponder/CHANGELOG.md
index ae0bde5d..22954d1c 100644
--- a/packages/create-ponder/CHANGELOG.md
+++ b/packages/create-ponder/CHANGELOG.md
@@ -1,7 +1,5 @@
 # create-ponder
 
-## 0.7.2
-
 ## 0.7.1
 
 ## 0.7.0
diff --git a/packages/create-ponder/package.json b/packages/create-ponder/package.json
index dae81c1b..578ace6b 100644
--- a/packages/create-ponder/package.json
+++ b/packages/create-ponder/package.json
@@ -1,6 +1,6 @@
 {
   "name": "create-ponder",
-  "version": "0.7.2",
+  "version": "0.7.1",
   "type": "module",
   "description": "A CLI tool to create Ponder apps",
   "license": "MIT",
diff --git a/packages/eslint-config-ponder/CHANGELOG.md b/packages/eslint-config-ponder/CHANGELOG.md
index 48ab71d8..7f6da1a9 100644
--- a/packages/eslint-config-ponder/CHANGELOG.md
+++ b/packages/eslint-config-ponder/CHANGELOG.md
@@ -1,7 +1,5 @@
 # eslint-config-ponder
 
-## 0.7.2
-
 ## 0.7.1
 
 ## 0.7.0
diff --git a/packages/eslint-config-ponder/package.json b/packages/eslint-config-ponder/package.json
index 0ba4af32..167b06dc 100644
--- a/packages/eslint-config-ponder/package.json
+++ b/packages/eslint-config-ponder/package.json
@@ -1,6 +1,6 @@
 {
   "name": "eslint-config-ponder",
-  "version": "0.7.2",
+  "version": "0.7.1",
   "description": "ESLint config for Ponder apps",
   "license": "MIT",
   "main": "./index.js",


Test patch:
diff --git a/packages/core/src/indexing-store/historical.test.ts b/packages/core/src/indexing-store/historical.test.ts
index 61d1c54a..30234ab9 100644
--- a/packages/core/src/indexing-store/historical.test.ts
+++ b/packages/core/src/indexing-store/historical.test.ts
@@ -556,7 +556,7 @@ test("default", async (context) => {
   const schema = {
     account: onchainTable("account", (p) => ({
       address: p.hex().primaryKey(),
-      balance: p.bigint().default(10n),
+      balance: p.integer().default(0),
     })),
   };
 
@@ -573,7 +573,7 @@ test("default", async (context) => {
     address: zeroAddress,
   });
 
-  expect(result).toStrictEqual({ address: zeroAddress, balance: 10n });
+  expect(result).toStrictEqual({ address: zeroAddress, balance: 0 });
 
   await cleanup();
 });