2.3.10 • Published 1 year ago
@wandity/guides-prisma-client v2.3.10
Prisma Migrations
Modifying schema
Steps
- Modify schema.prisma
- run
npm run migrate:dev
to create a database migration with the modified schema structure - run
npm run generate
to generate the prisma client files to publish - change the version number in the package.json inside the prisma/guide-client-package (to publish the package).
- The package will be published (GitHub Actions) when we push to
dev
and thera are changes in the prisma/guide-client-package directory
- The package will be published (GitHub Actions) when we push to
- the push to
dev
will also trigger a GitHub Action to deploy to staging at Fly.io. This will runnpx prisma migrate deploy
to apply the migration to the "production/staging" database. This command is set up in fly.toml. - Update version in the package clients. For guide prisma client only in the wandity-remix project for now.
- Prisma has two commands:
- prisma migrate dev to generate migrations in the development environment
- prisma migrate deploty to apply migrations to production/staging (in CI/CD) using the DATABASE_URL env variable
- https://www.prisma.io/docs/concepts/components/prisma-migrate/migrate-development-production
Development
- The database url is saved in .env