big nerd
ovyerus / prismaliser Goto Github PK
View Code? Open in Web Editor NEWVisualise your Prisma schema!
Home Page: https://prismaliser.app
License: MIT License
Visualise your Prisma schema!
Home Page: https://prismaliser.app
License: MIT License
big nerd
This is a weird one. If I define the relation on my "UserProfile"-Model the console gets spammed by warnings:
couldn't create edge for source handle id: User-UserToUserProfile-UserProfile; edge id: eUserToUserProfile
If you however switch it around and define the relation on the side of the user model it works. Any Idea whats wrong there?
NOT WORKING:
model User {
id String @id @unique @default(uuid()) @db.Char(36)
username String @unique @db.VarChar(255)
UserProfile UserProfile?
}
model UserProfile {
id String @id @unique @db.Char(36)
about String? @db.LongText
User User @relation(fields: [id], references: [id])
}
WORKING:
model User {
id String @id @unique @default(uuid()) @db.Char(36)
username String @unique @db.VarChar(255)
UserProfile UserProfile @relation(fields: [id], references: [id])
}
model UserProfile {
id String @id @unique @db.Char(36)
about String? @db.LongText
User User?
}
i install the app but running with an error saying
'Error: Invariant: Expected relative import to start with "next/", found "_next@13.4.13@next/dist/server/future/route-kind"'
It looks like the version compatibility with next.js 13.4.13. When the next.js version rolls back to 13.4.8, it works well.
But just wondering, how would I modify the code in order to make it adapt to the latest next.js version
Hey Michael, if you're looking to swap out Monaco for something else, you can take a look at CodeMirror and https://github.com/prisma/text-editors (uses codemirror under the hood). I wasn't involved in the building process but I'd be happy to take a stab at this issue too.
Hello there,
After I hit copy link and I paste the link in the browser it gives me 431.
Any idea why might that happen ?
Here is the link
Thank you.
Currently for default schema on https://prismaliser.ovy.cloud/
Removing the native type definition fixes the problem of course.
Maybe db
is not defined as the datasource
name that is sent in as validation? Could be that you have to add that (or just include it in the default schema for the validation to be able to pick it up from there).
Update: Yep, adding this to the default schema makes it work:
datasource db {
provider = "mysql"
url = "mysql://foo"
}
It would be nice if the table positions are also included in the Copy Link URL, that way we won't have to constantly rearrange the tables whenever we open the link.
should format db tables without overlapping
Prisma v4.3.0 mentions that the prisma format
command now uses a WASM module (@prisma/prisma-fmt-wasm
).
Currently formatting is done via an API endpoint which uses the @prisma/internals
package. It might be worth looking into seeing how hard it is to commandeer this WASM module to provide schema formatting on the client side, without needing to call out to the API.
Hey @Ovyerus ๐๐ฝ
A nice-to-have feature would be creating a project with the schema and inviting others or being able to share the link to your schema with someone else
When using MongoDB as a datasource, users are able to specify embedded documents with the type
keyword. We don't currently handle this but I reckon it would be nice to. Reference
Example schema
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model MyModel {
id String @id @default(auto()) @map("_id") @db.ObjectId
types MyType[]
}
type MyType {
value String
public Boolean
}
This error happened when I copy/paste a prisma mongo schema
And wo way to delete the wrong schema
Add a button to save the diagram into a image
I can take care of this โ setting up renovate or dependabot to handle updating the Prisma versions if you'd like ๐
Do you have any preference?
This issue provides visibility into Renovate updates and their statuses. Learn more
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
Looks like the current system breaks weirdly when a schema results in more than one error. Need to find a fix for that.
Just came across this and am excited after looking around for a long time for a self hostable Prisma schema visualiser. Below are some of the minimal use cases that I've been looking for from a package like this and it would be good to get your input on what they would look like and whether you've already considered them.
Ability to install using a package manager and run via cli. e.g.
yarn add prismaliser --dev
Ability to pass the schema file via argument to docker run or cli
docker run -p 3000:3000 ghcr.io/ovyerus/prismaliser --schema=<path-to-schema-file.prisma>
or
yarn prismaliser run --schema=<path-to-schema-file.prisma>
VScode extension that can automatically be opened to the side when a schema.prisma file is opened. Similar to bicep visualiser.
The current implementation is wonky and doesn't actually explain some of the decisions I made years, needs to be rewritten to be better and actually documented. Also because I've found the cause for #45 but it seems hard to fix in the current state sadly.
I'm using Prisma together with MongoDB and utilize embedded documents.
When I paste in the following example that makes use of this:
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model MyModel {
id String @id @default(auto()) @map("_id") @db.ObjectId
types MyType[]
}
type MyType {
value String
public Boolean
}
I recieve the following error:
Application error: a client-side exception has occurred (see the browser console for more information).
With the following console output:
TypeError: Cannot read properties of undefined (reading 'isList')
I can imagine this happens because Prismaliser was last released before Prisma started supporting embedded documents.
Hi!
I didn't get if it's possible to feed my local schema file when launching visualizer or even better when udpates in preview and locally are synced?
Can you make this as vs code extension?
In the visualizer, the crows feet point to the "one" instead of pointing to the "many".
model Person {
id Int @id @default(autoincrement())
friends Friends[]
}
model Friends {
id Int @id @default(autoincrement())
Person Person? @relation(fields: [personId], references: [id])
personId Int?
}
Shouldn't it be the other way around?
reproduce: Insert example code on the Prismalizer app
model User {
id Int @id @default(autoincrement())
profile Profile?
}
model Profile {
id Int @id @default(autoincrement())
user User @relation(fields: [userId], references: [id])
userId Int @unique // relation scalar field (used in the `@relation` attribute above)
}
expect: connecting lines for one-to-one relationship between models.
output: Models without connecting lines for one to one model
It would be really nice if there was an extension to VSCode that could open a prisma schema preview using prismaliser, like the built-in markdown previewer of vscode or other extensions like draw.io
I don't know if this would be in the scope of the project, but it seems like a cool idea.
It would be really nice if we could export the preview as an image. This could have usecases where we want to store it as documentation or include it in a website
I think this tool is great, however, it's a bit annoying to copy-paste Prisma schema into the prismaliser.app website. It could be an interesting feature to have a .png image automatically generated each time you run prisma db push
command. It would be placed in the same folder along with the schema file and would always be up to date.
CockroachDB is a supported Prisma database provider: https://www.prisma.io/docs/concepts/database-connectors/cockroachdb
However, loading a CockroachDB Prisma schema into Prismaliser gives an error saying it's not known:
Similarly, Cockroach functions such as sequence()
don't appear to be supported either:
It'd be great to eventually add support for Cockroach schemas to Prismaliser. Love the project
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.