Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Drizzle JSON types are not transferred to schema.mjs on sqlite #710

@omp-ocyan

Description

@omp-ocyan

Describe the bug
When declaring a JSON field in db/schema.ts with a custom type, the type isn't copied to schema.mjs

My project's on sqlite, so not sure if the same happens in other configs

For example:

// db/schema.ts
clientIds: text('client_ids', { mode: 'json' }).$type<string[]>().notNull(),

omits the type and becomes

// schema.mjs
clientIds: text('client_ids', { mode: 'json' }).$type().notNull(),

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a schema in server/db/schema.ts that includes a JSON field with $type<{some type}>()
  2. Run nuxt db generate
  3. Open schema.mjs
  4. See error

Expected behavior
The schema should be copied with the type included.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions