This repository was archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Introspection spec #153
Draft
janpio
wants to merge
18
commits into
master
Choose a base branch
from
introspection
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Introspection spec #153
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
0547854
bare minimum introspection spec as starting point
janpio 106ae7f
docs: Update TOC
github-actions[bot] f2d98bf
Update README.md
janpio 873a6b1
docs: Update TOC
github-actions[bot] 274df91
add highlevel description for introspection
do4gr 7547fc1
link to headlines, remove copypasta
do4gr 7399717
docs: Update TOC
github-actions[bot] 0097c43
Update README.md
janpio 780efc5
docs: Update TOC
github-actions[bot] 80d427d
add structure to describe current implementation
do4gr 23ba0e5
docs: Update TOC
github-actions[bot] 7fa55ee
add more sub points, add enums
do4gr 317edb3
Merge branch 'introspection' of https://github.com/prisma/specs into …
do4gr 88aa485
docs: Update TOC
github-actions[bot] c924f1f
more relation explanations, enum comments
do4gr dfbdeca
Merge branch 'introspection' of https://github.com/prisma/specs into …
do4gr 25bb01c
Remove areas that are covered by the PSL -> SQL spec already.
do4gr 1f5ba66
docs: Update TOC
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,20 +5,12 @@ | |
| - State: | ||
| - Spec: In Progress 🚧 | ||
| - Implementation: Unknown ❔ | ||
|
|
||
| When a user gets started with Prisma in a brownfield project, they can let Prisma introspect their database to generate the initial Prisma data model definition. | ||
|
|
||
| --- | ||
|
|
||
| <!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
| <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
|
|
||
|
|
||
| - [Motivation](#motivation) | ||
| - [Implementation](#implementation) | ||
| - [Current](#current) | ||
| - [Future 👽](#future-) | ||
|
|
||
| <!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
|
||
| ## Motivation | ||
|
|
@@ -36,22 +28,16 @@ Introspection happens in the following steps: | |
| * The introspection connector takes that db-schema representation and converts it into Prismas internal datamodel representation | ||
| * The internal datamodel representation gets rendered into the Prisma schema | ||
|
|
||
| The formats for the connection strings are discussed in the schema spec. https://github.com/prisma/specs/blob/master/schema/Readme.md | ||
| The formats for the connection strings are discussed in the schema spec. https://github.com/prisma/specs/tree/master/schema#supported-fields | ||
| The conversion from the sql-schema to the Prisma internal datamodel changes the information from a description of the data layout / connection in the db to the data structure used to generate the API. This means that some tables / collections that are present in the database are omitted while some fields that have no representation in the database are generated. | ||
|
|
||
| * Backrelation fields for relations that store Ids in the model table | ||
| * Omitting Prisma style M:N relation tables and adding relationfields to their models | ||
| * Omitting Prisma style scalar list tables and instead adding the list fields to their models | ||
|
|
||
| The logic Prisma uses to create names for relations / relation fields in cases where they are not specified in the database is also described in the Schema spec. | ||
| The logic Prisma uses to create names for relations / relation fields in cases where they are not specified in the database is also described in the Schema spec. https://github.com/prisma/specs/tree/master/schema#relations | ||
|
|
||
| The renderer then takes the internal datamodel representation and prints it. While doing this, it omits printing out some information if it follows Prismas opionionation. Examples include: | ||
|
|
||
| * not printing relation names for unambigous relations if their name matches a Prisma style M:N relation table '_PostToUser' | ||
| * not printing the @relation(references: id) if the foreign key is on the lexicographically lower model | ||
|
|
||
| ### Current | ||
|
|
||
|
|
||
| ### Future 👽 | ||
|
||
|
|
||
| * not printing the @relation(references: id) if the foreign key is on the lexicographically lower model | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually "require" this introduction summary sentence - so we should come up with something more generalized about "Introspection" in the Prisma context. (Matt might have something liek that already in his Prisma framework PR)