question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow creating schema without source files

See original GitHub issue

It looks like there’s currently only support for creating a Prisma schema by creating specific folders to hold mixins, models, and enums. This seems like a great approach for the typical use-case where you want to programmatically create and maintain a project’s schema.prisma file.

However, my use-case is a bit different. I’m trying to parse a GraphQL schema and build up a Prisma schema string on-demand. Essentially, I want to be able to independently create Prisma models, enums, and mixins and store them in variables, from which I’ll later be able to create a complete (or partial) Prisma schema string by calling toString() on all of the objects and doing string concatentation.

I tried to get this to work by importing and using functions like createModel, createMixin, etc. and calling toString() on the resulting PrismaModels, but it doesn’t look like this is possible because there’s a check for an existing schema object here.

Has there been any thought given to being able to support such use-cases?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
efreilacommented, Oct 15, 2022

@ridafkih Thanks for opening the PR so quickly! Taking a look at it now and should have it reviewed soon.

0reactions
ridafkihcommented, Oct 16, 2022

@efreila Released in v1.6.0! Let me know if I broke anything with my unit testing & lint configuration changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

types/mongoose create schema doesn't allow string source to ...
I'm going to post a PR that reverts it soon. This is not the first attempt made at creating a schema for document...
Read more >
Specifying a schema | BigQuery - Google Cloud
Duplicate column names are not allowed even if the case differs. For example, a column ... Integer, INT64, Numeric values without fractional components....
Read more >
CREATE SCHEMA (Transact-SQL) - Microsoft Learn
When a user without a database user account creates an object without specifying an existing schema, a database principal and default schema ......
Read more >
CREATE SCHEMA - Amazon Redshift - AWS Documentation
A user that is not a superuser but that has CREATE SCHEMA permission can create a schema with a defined quota. When you...
Read more >
Mongoose v6.8.1: Schemas
Each key in our code blogSchema defines a property in our documents which will be cast to its associated SchemaType. For example, we've...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found