prisma / prisma/orm

Allow default native types in SQLite (e.g. `@db.Text` for scalar type `String`)

Open
#9,012 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature topic: @db.Text topic: native database types topic: schema topic: sqlite
Dominant language
TypeScript
Stars
47.6k
Forks
2.5k
Avg merge
21h 59m
Merged PRs (30d)
95

Description

Problem

Even though SQLite's native data type for strings is TEXT, trying to actually use @db.Text as the native data type results in an error: "Native type Text is not supported for sqlite connector." This is counter-intuitive since the two are literally named the same thing and SQLite only has one string-like datatype, TEXT.

Suggested solution

Map both String and native type db.Text to TEXT in SQLite.

Additional context

It seems reasonable to allow a developer to be more expressive in the schema, declaring their intent for these fields. Traditionally, in the database world, a "string" would default to VARCHAR (which has a max of 255 characters) so if you want to allow more, you need to use TEXT. This isn't necessary in SQLite, but it can still help to visually express that you expect a certain field to contain lots of text.

This is also helpful if/when someone decides to move from SQLite to another database: no need to go through and add more native types since they're already in place.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files or tests. Start by locating the SQLite connector's native-type validation and mapping logic, then trace how String and @db.Text are handled. Done means both schema types map to SQLite TEXT without the unsupported-native-type error, with coverage for the accepted schema and generated database behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
sqlite, typescript
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.