Giter Site home page Giter Site logo

Comments (2)

stuible avatar stuible commented on June 12, 2024

I am also struggling with this issue. Would love to see some improvements in the documentation around this area!

from keystone.

pc-erin avatar pc-erin commented on June 12, 2024

I know you can use prisma's seeding feature to inject database entries. Maybe we're supposed to put all our dev data in a seed file? If so it would be good to have the docs mention that.

It might still be an issue for projects where you need to constantly be changing data during development and testing. Same for projects that involve file/image uploads since I'm not sure how you'd put those in a seed file.

I've been reading through the docs, and the only other way I can see to do migrations is to change your dev script to keystone dev --no-db-push, which doesn't make any database changes, so you have to manually run keystone prisma migrate dev each time you change the schema.

I also tried to figure out a way to get back to a working state after using the default push behavior, without deleting all the dev data.

You can use:

keystone prisma migrate diff --from-migrations migrations --to-schema-datasource schema.prisma --script --shadow-database-url='[SHADOW_DATABASE_URL]' > migrations/[migration_number_and_name]/migration.sql

To create the missing migration.

Then run keystone prisma migrate resolve --applied [migration_number_and_name], to tell the database that the missing migration has already been applied.

After that the database should be fully up to date with the migrations, and you can switch over to using the --no-db-push manual migration mode.

Not sure if that's how it's intended to be done, but those are my workarounds so far.

from keystone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.