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
[legacy-framework] Fix blitz generate model
to add fields to existing model instead of duplicating
#1251
Merged
flybayer
merged 2 commits into
canary
from
update-existing-model-instead-of-creating-new-one
Oct 10, 2020
Merged
[legacy-framework] Fix blitz generate model
to add fields to existing model instead of duplicating
#1251
flybayer
merged 2 commits into
canary
from
update-existing-model-instead-of-creating-new-one
Oct 10, 2020
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
…isting model only with missing fields.
Size Change: +1.61 kB (0%) Total Size: 189 kB
ℹ️ View Unchanged
|
flybayer
reviewed
Oct 5, 2020
//replace all content with the newly added fields for the already existing model | ||
this.fs.write(path.resolve("db/schema.prisma"), schema.replace(model, newModel)) | ||
} | ||
} | ||
} | ||
log.success( |
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.
Awesome @engelkes-finstreet!! Works great!
One more tweak, let's switch this success message do say "created" or "updated" depending on whether it added the whole model or just updated it.
Tell the user if the model was created or updated.
flybayer
changed the title
Checks if the model and the fields to generate exists.
Fix Oct 10, 2020
blitz generate model
to add fields to existing model instead of duplicating
flybayer
deleted the
update-existing-model-instead-of-creating-new-one
branch
October 10, 2020 20:01
wanjuntham
pushed a commit
to wanjuntham/blitz
that referenced
this pull request
Oct 11, 2020
… duplicating (blitz-js#1251) (patch)
nahue
added a commit
to nahue/blitz
that referenced
this pull request
Oct 13, 2020
…-ink * 'canary' of github.com:blitz-js/blitz: docs: add alexnaiman as a contributor (blitz-js#1299) Fix circular dependencies in blitz core (blitz-js#1249) docs: add aaronfulkerson as a contributor (blitz-js#1295) Remove "--experimental" from "blitz db studio" (blitz-js#1272) Remove Simon Debbarma and Jack Clancy from L1 maintainers. (blitz-js#1290) Update @aericson as a contributor Add @Kosai106 as a contributor docs: add cajotafer as a contributor (blitz-js#1293) (newapp) Add yarn/npx to global install instructions in readme (blitz-js#1285) Fix to allow babel config modification in Recipes (blitz-js#1280) Fix all recipes to add their context providers above getLayout() (blitz-js#1279) docs: add aericson as a contributor (blitz-js#1292) (newapp) Fix validateDOMNesting error from default home page (blitz-js#1277) Fix `blitz generate model` to add fields to existing model instead of duplicating (blitz-js#1251) Fix to not run husky during new app creation (blitz-js#1270) Adds tests for useSession in core super tokens (blitz-js#1258)
ntgussoni
added a commit
to ntgussoni/blitz
that referenced
this pull request
Feb 7, 2021
* upstream/canary: (70 commits) docs: add alexnaiman as a contributor (blitz-js#1299) Fix circular dependencies in blitz core (blitz-js#1249) docs: add aaronfulkerson as a contributor (blitz-js#1295) Remove "--experimental" from "blitz db studio" (blitz-js#1272) Remove Simon Debbarma and Jack Clancy from L1 maintainers. (blitz-js#1290) Update @aericson as a contributor Add @Kosai106 as a contributor docs: add cajotafer as a contributor (blitz-js#1293) (newapp) Add yarn/npx to global install instructions in readme (blitz-js#1285) Fix to allow babel config modification in Recipes (blitz-js#1280) Fix all recipes to add their context providers above getLayout() (blitz-js#1279) docs: add aericson as a contributor (blitz-js#1292) (newapp) Fix validateDOMNesting error from default home page (blitz-js#1277) Fix `blitz generate model` to add fields to existing model instead of duplicating (blitz-js#1251) Fix to not run husky during new app creation (blitz-js#1270) Adds tests for useSession in core super tokens (blitz-js#1258) Add Alexandru Stratulat as L1 Maintainer (blitz-js#1271) v0.24.1 Fix page template to use useMutation (blitz-js#1269) update patch for release script (meta) ...
dillondotzip
changed the title
Fix
[legacy-framework] Fix Jul 7, 2022
blitz generate model
to add fields to existing model instead of duplicatingblitz generate model
to add fields to existing model instead of duplicating
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.
Updates the existing model only with missing fields.
Closes: blitz-js/legacy-framework#704
What are the changes and their implications?
Right now if a user generates a model that already exists a new model is added to the
schema.prisma
. This changes the behavior to update the existing model only with the fields that do not exist yet.Checklist