new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Drizzle · SQLite · all subjects

arktype/update-schema

3 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

createUpdateSchema function

createUpdateSchema is imported from 'drizzle-orm/arktype' and generates an arktype schema that validates data to be updated in the database. It can be used to validate API requests. All fields in the schema are optional, allowing partial updates of records.

createUpdateSchema example with partial updates

Example showing createUpdateSchema for partial updates: import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'; import { createUpdateSchema } from 'drizzle-orm/arktype'; import { ArkErrors } from 'arktype'; const users = sqliteTable('users', { id: integer().primaryKey({ autoIncrement: true }), name: text().notNull(), age: integer().notNull() }); const userUpdateSchema = createUpdateSchema(users); const user = { age: 35 }; const parsed: ArkErrors | { name?: string | undefined, age?: number | undefined } = userUpdateSchema(user); if (parsed instanceof ArkErrors) { console.error(parsed.summary); process.exit(1); } await db.update(users).set(parsed).where(eq(users.name, 'Jane'));

createUpdateSchema with typebox-legacy

The createUpdateSchema function from drizzle-orm/typebox-legacy generates a Typebox schema that validates data shape for UPDATE operations. It can be used to validate API requests. In update schemas, all columns become optional (nullable or undefined) since updates only need to specify the columns being changed.

Give your agent this brain