prisma / prisma-client-js

Type-safe database client for TypeScript & Node.js (ORM replacement)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DMMF does not support field type NativeType

thekalko opened this issue · comments

Bug description

Why it does not support String, when I use @db.Text?

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
  previewFeatures = ["nativeTypes"]
}

generator client {
  provider = "prisma-client-js"
}

... 

model Product {
  id                    Int           @default(autoincrement()) @id
  code                  String        @unique
  name                  String
  longName              String?
  productVariations     ProductVariation[]
  categories            ProductCategory[]
  brand                 ProductBrand[]
  favoritProducts       FavoritProduct[]
  descrtiption          String         @db.Text
  status                STATUS         @default(ACTIVE)
  updatedAt             DateTime       @updatedAt
  createdAt             DateTime       @default(now())
}
Error: Schema parsing
thread 'main' panicked at 'not implemented: DMMF does not support field type NativeType(String, NativeTypeInstance { name: "Text", args: [], serialized_native_type: String("Text") })', libs/datamodel/core/src/json/dmmf/to_dmmf.rs:123:16
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::panicking::default_hook::{{closure}}
   4: std::panicking::default_hook
   5: std::panicking::rust_panic_with_hook
   6: rust_begin_unwind
   7: std::panicking::begin_panic_fmt
   8: datamodel::json::dmmf::to_dmmf::field_to_dmmf
   9: datamodel::json::dmmf::to_dmmf::schema_to_dmmf
  10: datamodel::json::dmmf::to_dmmf::render_to_dmmf_value
  11: query_engine::main::main::{{closure}}::main::{{closure}}
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  13: std::thread::local::LocalKey<T>::with
  14: scoped_tls::ScopedKey<T>::set
  15: async_executor::LocalExecutor::run
  16: scoped_tls::ScopedKey<T>::set
  17: tokio::runtime::context::enter
  18: tokio::runtime::Runtime::enter
  19: std::thread::local::LocalKey<T>::with
  20: std::thread::local::LocalKey<T>::with
  21: async_std::task::builder::Builder::blocking
  22: query_engine::main
  23: std::rt::lang_start::{{closure}}
  24: std::rt::lang_start_internal
  25: main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

How to reproduce

With the schema above.

npx prisma generate

Expected behavior

Just normally build the TypeScript client. Type String is supported by generation!

Prisma information

"@prisma/cli": "^2.7.1",
"@prisma/client": "^2.7.1",

Environment & setup

  • OS: Mac OS
  • Database: MySQL
  • Node.js version: v12.16.1
  • Prisma version:
Current platform     : darwin
Query Engine         : query-engine 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/query-engine-darwin)
Migration Engine     : migration-engine-cli 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/migration-engine-darwin)
Introspection Engine : introspection-core 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/introspection-engine-darwin)
Format Binary        : prisma-fmt 5c2ad460cf4fe8c9330e6640b266c046542c8b6a (at node_modules/@prisma/cli/prisma-fmt-darwin)
Studio               : 0.288.0

@thekalko Natives types are work in progress and haven't fully implemented yet so this is expected to fail right now.

Please while we complete the work and release them.

Native types are implemented by now, so closing this as this should work now.