Skip to content
This repository was archived by the owner on Aug 25, 2021. It is now read-only.
This repository was archived by the owner on Aug 25, 2021. It is now read-only.

Unexpected token. when running prisma2 lift save after adding custom type definition #94

@nickreynke

Description

@nickreynke

Since Long integers (64-Bit) are not implemented yet (see https://github.com/prisma/photonjs/issues/170) I've tried adding a custom type definition to my schema.prisma file:

  datasource pg {
    provider = "postgresql"
    url      = env("POSTGRES_URL")
  }

  generator photonjs {
    provider = "photonjs"
  }

+ type Long Int @pg.bigint

  model User {
    id    String  @id @default(cuid())
    name  String?
    email String  @unique
+   likes Long
    posts Post[]
  }

  model Post {
    id        String  @id @default(cuid())
    title     String
    published Boolean @default(false)
    author    User?
  }

When then running prisma2 lift save I ran into the following error:

Failed listMigrations at 2019-08-02T19:26:14.924Z

RPC Input One Line

{"id":1,"jsonrpc":"2.0","method":"listMigrations","params":{"projectInfo":"","sourceConfig":"datasource pg {\n  provider = \"postgresql\"\n  url      = env(\"POSTGRES_URL\")\n}\n\ngenerator photonjs {\n  provider = \"photonjs\"\n}\n\ntype Long Int @pg.bigint\n\nmodel User {\n  id    String  @id @default(cuid())\n  name  String?\n  email String  @unique\n  likes Long\n  posts Post[]\n}\n\nmodel Post {\n  id        String  @id @default(cuid())\n  title     String\n  published Boolean @default(false)\n  author    User?\n}"}}

RPC Input Readable

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "listMigrations",
  "params": {
    "projectInfo": "",
    "sourceConfig": "datasource pg {\n  provider = \"postgresql\"\n  url      = env(\"POSTGRES_URL\")\n}\n\ngenerator photonjs {\n  provider = \"photonjs\"\n}\n\ntype Long Int @pg.bigint\n\nmodel User {\n  id    String  @id @default(cuid())\n  name  String?\n  email String  @unique\n  likes Long\n  posts Post[]\n}\n\nmodel Post {\n  id        String  @id @default(cuid())\n  title     String\n  published Boolean @default(false)\n  author    User?\n}"
  }
}

RPC Response

null

Stack Trace

thread 'main' panicked at 'loading the connector failed.: DataModelErrors { code: 1001, errors: ["Unexpected token. Expected one of: Start of block (\"{\")."] }', src/libcore/result.rs:997:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::_print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::continue_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed
   9: migration_core::migration_engine::MigrationEngine::init
  10: <F as jsonrpc_core::calls::RpcMethodSimple>::call
  11: <F as jsonrpc_core::calls::RpcMethod<T>>::call
  12: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll
  13: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll
  14: <futures::future::map::Map<A,F> as futures::future::Future>::poll
  15: <futures::future::either::Either<A,B> as futures::future::Future>::poll
  16: futures::task_impl::std::set
  17: std::thread::local::LocalKey<T>::with
  18: futures::future::Future::wait
  19: jsonrpc_core::io::IoHandler<M>::handle_request_sync
  20: migration_core::rpc_api::RpcApi::handle
  21: migration_engine::main
  22: std::rt::lang_start::{{closure}}
  23: std::panicking::try::do_call
  24: __rust_maybe_catch_panic
  25: std::rt::lang_start_internal
  26: main

Metadata

Metadata

Assignees

Labels

kind/docsA documentation change is required.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions