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

Gel prisma #1162

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Gel prisma #1162

wants to merge 3 commits into from

Conversation

vpetrovykh
Copy link
Member

No description provided.

Add the `prisma` command to the list of valid @edgedb/generate commands.
It requires a `--file` and some way of connecting the client (DSN or
whatever other method). The generated Prisma schema will be output as
specified by `--file`.
Test the basic CRUD capability of the exposed Prisma models.
import type { Client } from "edgedb";
import * as fs from "node:fs";

const WARNINGS: string[] = [];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we log these?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe instead of collecting them, just print them into stderr as they happen?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can print them to stdout with console.log, tbh. I don't think our debug output in our generators are very principled about that sort of thing.

Comment on lines +151 to +152
const types = <JSONType[]>JSON.parse(await client.queryJSON(INTRO_QUERY));
const modules = <string[]>JSON.parse(await client.queryJSON(MODULE_QUERY));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why queryJSON -> JSON.parse instead of query?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was mostly a translation from the Python version of this tool. There I was collecting things into dicts rather than native objects so that I could access things uniformly via [ ] and not worry about fields. I realize that in JS version this is not necessary, so a query is probably right in this spot.

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