prisma / prisma/orm

Possibility to ignore incompatible native types

Open
#6,509 5 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature topic: introspection-configuration topic: native database types topic: prisma generate
Dominant language
TypeScript
Stars
47.6k
Forks
2.5k
Avg merge
21h 59m
Merged PRs (30d)
95

Description

Problem

I am testing my server on SQLite while the actual production server is using Postgres. I am doing that by switching out the datasource block completely by merging different base files with prisma-merge. Recently I have started using native types. For example I am using @db.Uuid which is available in Postgres, however it is not available in SQLite.

The problem is that when setting up my tests it is throwing this error:
error: Native type Uuid is not supported for sqlite connector.

Suggested solution

I think what would be best for this is if you could set an option when running prisma generate or in the datasource block to ignore native types completely? There could also already be such possibility but I couldn't find any.

Alternatives

Of course I could test my server against a Postgres database which could save me a lot of trouble but this solution of testing with SQLite I came up with worked so well in the past...
Do you have any other ideas on how to run tests involving database queries?

Additional context

This is the full error of one field:

error: Native type Uuid is not supported for sqlite connector.
  -->  schema.prisma:15
   | 
14 | model User {
15 |     id String @db.Uuid @id
   | 

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

Start with the schema.prisma example and the prisma generate and datasource configuration described in the issue, then trace where SQLite rejects @db.Uuid. Done would mean the requested behavior and configuration surface are defined and covered for the SQLite-versus-Postgres testing scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sqlite
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.