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

Add example project using Prisma #188

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Add example project using Prisma #188

wants to merge 3 commits into from

Conversation

amotl
Copy link
Member

@amotl amotl commented Dec 6, 2023

About

Verify Prisma works well with CrateDB.

Details

The code has been scaffolded like this:

npx try-prisma@latest --template javascript/script --install npm --name . --path .

Thoughts

Two pointers shared by @BaurzhanSakhariev. Thanks!

@proddata, @hammerhead, @hlcianfagna

The code has been scaffolded like this:

  npx try-prisma@latest --template javascript/script --install npm --name . --path .

This commit adds the result unmodified.
Comment on lines +22 to +29
### Create the database

Run the following command to submit the SQL DDL to the database. This will create
database tables for the `User` and `Post` entities that are defined in
[`prisma/schema.prisma`](./prisma/schema.prisma).
```shell
npx prisma migrate dev --name init
```
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prisma wants to run a CREATE SCHEMA command when using a connection string like postgresql://crate@localhost:5432/mydb?schema=public.

$ npx prisma migrate dev --name init
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "mydb", schema "public" at "localhost:5432"

Error: Schema engine error:
ERROR: line 1:8: no viable alternative at input 'CREATE SCHEMA'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using postgresql://crate@localhost:5432/?schema=doc as database connection string, it trips on the CREATE DATABASE statement.

Error: P3014

Prisma Migrate could not create the shadow database. Please make sure the database user has permission to create databases. Read more about the shadow database (and workarounds) at https://pris.ly/d/migrate-shadow

Original error:
ERROR: line 1:8: no viable alternative at input 'CREATE DATABASE'
   0: schema_core::state::DevDiagnostic
             at schema-engine/core/src/state.rs:270

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amotl

This comment was marked as duplicate.

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

Successfully merging this pull request may close these issues.

2 participants