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

Closed

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

Activity

  1. nickreynke commented on Aug 2, 2019

    @nickreynke
    Author

    FYI the error is also (kinda) mentioned by VS Code:

    Screenshot 2019-08-02 at 22 01 49

  2. nickreynke commented on Aug 4, 2019

    @nickreynke
    Author

    Still hapening with version [email protected].

  3. added
    kind/feature
    on Aug 5, 2019
  4. timsuchanek commented on Aug 5, 2019

    @timsuchanek
    Contributor

    Thanks for reporting! Scalar alias types are not implemented yet. We'll work on making that transparent.

  5. added
    kind/docs
    process/candidate
    and removed
    kind/feature
    on Aug 27, 2019
  6. added this to the Preview 10 milestone on Aug 30, 2019
  7. added and removed
    process/candidate
    on Aug 30, 2019
  8. modified the milestones: Preview 10, Preview 11 on Sep 6, 2019
  9. modified the milestones: Preview 11, Preview 12 on Sep 12, 2019
  10. nikolasburk commented on Sep 19, 2019

    @nikolasburk
    Contributor

    I've removed this from the docs to for now: prisma/orm#578

  11. modified the milestones: Preview 12, Preview 13 on Sep 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/docs

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions