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

drizzle-seed

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

drizzle-seed versioning for deterministic data

drizzle-seed uses versioning to manage outputs for static and dynamic data. When using the same seed number with the same version, values remain unchanged, ensuring true determinism. When changes are made to static data sources or dynamic data generation logic, the version is updated. You can choose between sticking with a previous version or using the latest.

drizzle-seed version parameter syntax

To specify a drizzle-seed version, use the syntax: await seed(db, schema, { version: '2' }). The version parameter is a string.

drizzle-seed version history

Version history of drizzle-seed: v1 (npm 0.1.1, no changes listed), v2 (npm 0.2.1, changed string() and interval({ isUnique: true })), v3 (npm 0.4.0, changed hash generating function), v4 LTS (npm 1.0.0-beta.8, changed uuid).

drizzle-seed version 2 interval generator change

In version 2, the unique interval generator was changed because the older version could produce intervals like '1 minute 60 seconds' and '2 minutes 0 seconds' as distinct values. However, when '1 minute 60 seconds' is inserted into SQLite, it is automatically converted to '2 minutes 0 seconds', causing unique constraint violations. The v2 generator fixes this by ensuring intervals are normalized before generation.

drizzle-seed version 2 string generator change

In version 2, string generators (both unique and non-unique) were changed to generate unique strings based on the length of text columns. This affects tables with text columns that have a maximum length parameter (e.g., varchar(20)) or unique text columns.

drizzle-seed version 3 hash generating function change

In version 3, the hash generating function was changed to generate the same hash regardless of Node.js or Bun version. The previous version generated different hashes depending on whether Bun or Node.js was used, and hashes varied across Node.js versions. All generators output different values compared to v2, even with the same seed number.

drizzle-seed version 4 uuid generator change

In version 4, the uuid generator was changed because UUID values generated by the old version fail Zod's v4 UUID validation. The new generator produces Zod v4-compliant UUIDs.

drizzle-seed version mixing example

You can use different generator versions by specifying the maximum version. For example, await seed(db, schema, { version: '2' }) will use the firstName generator of version 1 and the lastName generator of version 2 if lastName was only changed in v2 and firstName was only changed in v3 or later.

Drizzle Seed UUID generator upgraded to v4

The UUID generator in Drizzle Seed has been upgraded to produce RFC 4122 v4 compliant UUIDs, ensuring compatibility with Zod v4. Use `{ version: '1' }` to keep old behavior, or `{ version: '2' | '3' }` for newer generators.

Drizzle Seed refine allows skipping columns to use database defaults

In Drizzle Seed, columns can be skipped during seeding by setting them to `false` in the refine function. The database default will be used for skipped columns. Example: `columns: { name: f.fullName(), photo: false }`

Time-based generators accept min/max boundary parameters

Time-based generators in Drizzle Seed now accept `min` and `max` boundary parameters: `funcs.time({ min: '13:12:13', max: '15:12:13' })`, `funcs.timestamp({ min: '2024-01-01T00:00:00Z', max: '2025-01-01T00:00:00Z' })`, and `funcs.datetime({ min: '2024-01-01', max: '2025-01-01' })`.

Give your agent this brain