Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] No property validation when inserting values into a table #1266

Open
swan-of-bodom opened this issue Nov 20, 2024 · 0 comments
Open

[BUG] No property validation when inserting values into a table #1266

swan-of-bodom opened this issue Nov 20, 2024 · 0 comments

Comments

@swan-of-bodom
Copy link
Contributor

When inserting values into a table, i expect it to error when adding extra properties that are not in the schema. For example:

In ponder.schema.ts :

export const token = onchainTable("token", (t) => ({
  id: t.hex().primaryKey(),
  symbol: t.text(),
  name: t.text(),
  decimals: t.integer(),
  createdAtBlock: t.bigint(),
  createdAtTimestamp: t.bigint(),
  createdAtUTC: t.text(),
}));

Then in my token.ts:

  const thisCanBeAnything = 420;

  await db
    .insert(token)
    .values({
      id: address,
      name,
      symbol,
      decimals,
      createdAtBlock,
      createdAtTimestamp,
      createdAtUTC,
      thisCanBeAnything
    })
    .onConflictDoNothing();

There is no error when adding thisCaBeAnything although there is no property for this in my schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant