-
Notifications
You must be signed in to change notification settings - Fork 16
Improve introspection, then generate workflows #51
Description
After introspecting, you can't directly generate. We should make this workflow better:
$ prisma2 introspect --pg-db prisma-blog --pg-host localhost --pg-port 5432 --pg-schema public --pg-user m --pg-password ""
✔ Introspecting database public: 108ms
Created datamodel definition based on 4 database tables
Created 1 new file: Prisma DML datamodel (derived from existing database)
datamodel-1564666131.prisma
$ prisma2 generate
Error: Could not find /Users/m/Code/src/github.com/matthewmueller/prisma/capabilities/schema.prisma
Right now we require the following steps:
1) rename datamodel-1564666131.prisma
to schema.prisma
Suggestion: We can eliminate this step entirely in the default case and just write out a schema.prisma
After I fix the schema.prisma
, I'll run generate again:
$ prisma2 generate
info You dont have defined any generator in your schema.prisma, so nothing will be generated. You can define them like this:
generator photon {
provider = "photonjs"
}
Suggestion: In this case, I'd suggest we write a generator either by default or have an interactive workflow to add a generator if there isn't one that will write to the schema.
2) Copy and paste the generator
block
After I fix the generator
block, I'll run generate again:
$ prisma2 generate
Generating Photon JS Client to $HOME/prisma/capabilities/node_modules/@generated/photon
Suggestion: Make the path relative to CWD, tell the user how to use this. Right now generating into @generated/photon is a new technique and we need to educate our users on how to use it.