-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
POC: Generate a Prisma schema using migration metadata obtained from the sync service #872
Draft
alco
wants to merge
9
commits into
main
Choose a base branch
from
alco/generate-prisma-schema
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
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.
Conversation
This file contains 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
alco
force-pushed
the
alco/generate-prisma-schema
branch
8 times, most recently
from
January 26, 2024 11:26
c9d3d76
to
774a5a9
Compare
alco
changed the title
wip: generate prisma schema
POC: Generate a Prisma schema using migration metadata obtained from the sync service
Jan 26, 2024
alco
force-pushed
the
alco/generate-prisma-schema
branch
from
February 14, 2024 14:26
774a5a9
to
1a008de
Compare
Use this app to rerun client generation as you're reworking the generator implementation. .electric_migrations_reference/prisma/schema.prisma includes a Prisma schema obtained via `prisma db pull`. This is used as a reference for the new implementation.
This removes the need to run `prisma db pull` and side-steps all problems associated with it, caused by missing or incompatible functionality in Electric Migrations proxy's "prisma introspection mode".
…ting Postgres This commit shows the diff between the original Prisma schema that was obtained via `prisma db pull` and the updated implementation that only uses data obtained from the sync service's /api/migrations endpoint.
alco
force-pushed
the
alco/generate-prisma-schema
branch
from
April 17, 2024 13:37
1a008de
to
002ccfa
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes VAX-1339, #863.
This is a proof-of-concept pull request that demonstrates the ability to obtain a Prisma schema which is later used in the type-safe client generation process without having Prisma connect to the Migrations proxy.
Overview of the included changes:
SatOpMigrate.Column
message gets a newis_nullable
field. This information is needed to correctly indicate optional fields in the generated Prisma schema.SatOpMigrate
message is extended to allow for inclusion of an enum type definition: aCREATE TYPE ... AS ENUM ...
SQL statement and associated metadata (relevant commit range. @icehaunter @magnetised, I would love to get your feedback on this.introspectDB()
function is reimplemented to generate a Prisma schema from the migrations metadata and write it to the temporaryschema.prisma
file.clients/typescript/src/cli/migrations/migration-to-prisma-models.ts
file.How to proceed from here:
TODO: