Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TableDoesNotExist error #28

Closed
ltaoo opened this issue Apr 9, 2022 · 3 comments
Closed

TableDoesNotExist error #28

ltaoo opened this issue Apr 9, 2022 · 3 comments

Comments

@ltaoo
Copy link

ltaoo commented Apr 9, 2022

Hi, I run my project with simple code, but there is some error that I can't solve, can you help me?

here is my error log

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: InterpreterError(ConnectorError(ConnectorError { user_facing_error: Some(KnownError { message: "The table `main.User` does not exist in the current database.", meta: Object({"table": String("main.User")}), error_code: "P2021" }), kind: TableDoesNotExist { table: "main.User" } }))', ~/.cargo/git/checkouts/prisma-client-rust-fa967aa5ad0ec391/0f29315/src/query.rs:77:14

this is the link that can reproduce this error in my computer.
https://github.com/ltaoo/prisma-client-rust-bug

here is my system info

  System:
    OS: macOS 12.2.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 1.05 GB / 8.00 GB
    Shell: 5.8 - /bin/zsh
rustup --version
rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.60.0 (7737e0b5c 2022-04-04)`
rustc 1.60.0 (7737e0b5c 2022-04-04)
cargo 1.60.0 (d1fd9fe2c 2022-03-01)
@Brendonovich
Copy link
Owner

I think this is similar to steebchen/prisma-client-go#482, where sqlite relative paths are not resolved correctly, and so the database file is being created and migrated in the root of the repo but at runtime a new un-migrated database file is being created in the directory above the repo, so you get this error. For now I'd recommend either moving the schema.prisma file to the root of the repo (easier), or installing prisma-client-rust and the cli from the master branch (I have an annoying fix that will be included in v0.4.0)

@ltaoo
Copy link
Author

ltaoo commented Apr 9, 2022

This works, thank you very much!

@ltaoo ltaoo closed this as completed Apr 9, 2022
@fernandomarca
Copy link

I have the same problem, as I need to use integration as the node I made a special script in my package.json to always copy the database to the root of the project and activate the prism folder in its default location.
I used CPX for this.

"scripts": {
    "cargo:run": "cargo run",
    "prisma:migrate": "DISABLE_ERD=true npx prisma migrate dev && cpx ./prisma/dev.db/ ./",
    "prisma:generate": "npx prisma generate",
    "prisma:docs": "npx prisma-docs-generator serve"
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants