prisma / prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

Home Page:https://www.prisma.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

no such table dev.MyTable

jean-noelp opened this issue · comments

Hello,

I used prisma2 to manage my sqlite database, and after migrating to "preview021", I had to change my code from:
ctx.photon.mytables.findMany()
to
ctx.photon.mytable.findMany()
(without the "s").

But now, my server is logging this error:

Invalid `ctx.photon.mytable.findMany()` invocation in
/Users/xxxxxx/back/src/resolvers.ts:36:28

  32       status: args.status,
  33     }
  34   : {}
  35 
→ 36 return ctx.photon.mytable.findMany(

Reason: Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(SqliteFailure(Error { code: Unknown, extended_code: 1 }, Some("no such table: dev.Mytable"))) })

I tried to migrate, to generate... but this error is still here.
How to resolve it ?

A workaround:

  • I deleted dev.db file (also lost my data)
  • prisma2 migrate down --experimental ("No migration to roll back", supposedly)
  • prisma2 migrate up --experimental (tables created)
    and tables reappeared!

Hi,

The error message indicates that your database doesn't have the schema in place. You have already fixed this via migrating the database using prisma migrate as you have mentioned in the above steps.

Deletion of the database was unnecessary here as CLI would create the missing table but if you run into this situation again, please let us know. Closing this for now.

Got it.

In fact I had some errors by just migrating up.
Certainely caused by the combination "migration postgresql->sqlite" + "prisma2 alpha version --> preview21".

I will keep you informed if i run others similars issues.
Thanks.