Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Improve introspection, then generate workflows #51

@matthewmueller

Description

@matthewmueller

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.

Metadata

Metadata

Assignees

Labels

area/cliarea/introspectionkind/discussionDiscussion about if and how something should be written down in a specspec/changeAn existing spec should be changed or adapted

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions