Skip to content
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

Adds CLI flags to dev build and start to change what is built and run #8046

Merged
merged 26 commits into from
Feb 13, 2023

Conversation

borisno2
Copy link
Member

@borisno2 borisno2 commented Oct 25, 2022

Currently, Keystone provides the useMigrations config option to either enable or disable the generation of Prisma Migrations. When useMigrations is false, the default, running keystone dev performs a schema push to the DB and forces a reset if there is any drift. When useMigrations is true running keystone dev will generate the prisma migrations and also reset the DB if there is any drift.

The aim of this PR to give the developer more options when it comes to migrations. The current behaviour remains however the following is added:

  • Updates keystone prisma CLI to use the built configuration when the --frozen flag is used so that uncompiled ts files are not required after a build step - helpful when building Docker images without needing keystone.ts and all its dependencies.
  • Adds a --no-db-push flag for keystone dev that skips the schema push to the DB when useMigrations is set to false or undefined, used if you don't want to force keystone to use the database you have, for example, an existing DB you don't want to have migrations for.
  • Changes the behaviour of build so that it generates the schema files and adds a --frozen flag to build to force it to just validate instead (current behaviour)
  • Adds --no-server to dev to run dev without express, useful when not using express - ie Keystone in Next
  • Adds --no-ui (dev, build and start) and --no-prisma (dev and build) to build and/or run keystone either without the AdminUI or without Prisma
  • Marks useMigrations as deprecated - this config option will be removed in the next major release - use keystone prisma migrate dev to generate database migrations. To mirror existing behaviour of useMigrations use keystone prisma migrate dev && keystone dev --no-db-push

@changeset-bot

This comment was marked as resolved.

@vercel
Copy link

vercel bot commented Oct 25, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
keystone-next-docs ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 13, 2023 at 6:59AM (UTC)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 25, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 3c55c60:

Sandbox Source
@keystone-6/sandbox Configuration

@borisno2 borisno2 self-assigned this Oct 25, 2022
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from 9078d83 to 599e0fa Compare November 30, 2022 21:40
@vercel vercel bot temporarily deployed to Preview November 30, 2022 21:41 Inactive
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from 599e0fa to 7a4837d Compare December 13, 2022 03:03
@vercel vercel bot temporarily deployed to Preview December 13, 2022 03:09 Inactive
@vercel vercel bot temporarily deployed to Preview December 13, 2022 21:14 Inactive
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from db93d6d to d9a378d Compare December 13, 2022 22:02
@vercel vercel bot temporarily deployed to Preview December 13, 2022 22:06 Inactive
@vercel vercel bot temporarily deployed to Preview December 13, 2022 22:44 Inactive
@vercel vercel bot temporarily deployed to Preview December 14, 2022 03:12 Inactive
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from 4d91146 to d2b8acd Compare December 14, 2022 03:46
@vercel vercel bot temporarily deployed to Preview December 14, 2022 03:50 Inactive
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from d2b8acd to 1ccb5b9 Compare December 14, 2022 06:13
@vercel vercel bot temporarily deployed to Preview December 14, 2022 06:16 Inactive
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from 1b000b6 to a1fa327 Compare December 14, 2022 21:38
@vercel vercel bot temporarily deployed to Preview December 14, 2022 21:40 Inactive
@borisno2 borisno2 marked this pull request as ready for review December 14, 2022 23:12
@borisno2 borisno2 force-pushed the review-dev-migration-workflow branch from a1fa327 to 69d8aa4 Compare January 22, 2023 22:41
@vercel vercel bot temporarily deployed to Preview January 22, 2023 22:42 Inactive
@vercel vercel bot temporarily deployed to Preview February 2, 2023 04:25 Inactive
@vercel vercel bot temporarily deployed to Preview February 2, 2023 04:27 Inactive
@dcousens dcousens changed the title Refactor DB Migration Workflow Add keystone migrate Feb 2, 2023
@dcousens dcousens changed the title Add keystone migrate Add keystone migrate CLI command Feb 2, 2023
@vercel vercel bot temporarily deployed to Preview February 5, 2023 23:45 Inactive
@vercel vercel bot temporarily deployed to Preview February 6, 2023 01:46 Inactive
@vercel vercel bot temporarily deployed to Preview February 6, 2023 01:59 Inactive
@vercel vercel bot temporarily deployed to Preview February 6, 2023 02:05 Inactive
@vercel vercel bot temporarily deployed to Preview February 13, 2023 03:17 Inactive
@gautamsi
Copy link
Member

@borisno2 Am I able to build the admin ui separately yet?

@vercel vercel bot temporarily deployed to Preview February 13, 2023 03:40 Inactive
@dcousens dcousens force-pushed the review-dev-migration-workflow branch from 31d0e37 to aae3431 Compare February 13, 2023 03:49
@dcousens dcousens enabled auto-merge (squash) February 13, 2023 03:50
@vercel vercel bot temporarily deployed to Preview February 13, 2023 03:51 Inactive
@dcousens dcousens force-pushed the review-dev-migration-workflow branch from aae3431 to d60c825 Compare February 13, 2023 06:53
@vercel vercel bot temporarily deployed to Preview February 13, 2023 06:57 Inactive
@dcousens dcousens force-pushed the review-dev-migration-workflow branch from d60c825 to 3c55c60 Compare February 13, 2023 06:57
@vercel vercel bot temporarily deployed to Preview February 13, 2023 06:59 Inactive
@dcousens
Copy link
Member

Moved the removal of --reset-db to #8302, so we can merge this pull request and move forward.

@dcousens dcousens merged commit ead1241 into main Feb 13, 2023
@dcousens dcousens deleted the review-dev-migration-workflow branch February 13, 2023 07:10
dcousens added a commit that referenced this pull request Apr 5, 2023
…rom being used (#8455)

Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
@gautamsi
Copy link
Member

gautamsi commented Nov 6, 2023

What is the reasoning behind deprecation of useMigration? I see it will be removed but I do not understand why.
@borisno2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants