Skip to content

refactor: move prisma to a package #480

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

Merged
merged 1 commit into from
Aug 28, 2023
Merged

Conversation

lihebi
Copy link
Collaborator

@lihebi lihebi commented Aug 28, 2023

Prisma related code is now moved from apps/api/ folder to packages/prisma folder, so that the prisma client can be shared among different servers.

@lihebi
Copy link
Collaborator Author

lihebi commented Aug 28, 2023

To use the package in a server app, run pnpm add @codepod/prisma, and use like this:

import prisma from "@codepod/prisma";

prisma.repo.findFirst(...)

@lihebi lihebi merged commit e1a7151 into codepod-io:main Aug 28, 2023
@senwang86
Copy link
Collaborator

If you need to perform prisma migration

  • Attach the api container shell
  • run pnpm dlx prisma migrate dev --schema ../../packages/prisma/prisma/schema.prisma

@lihebi
Copy link
Collaborator Author

lihebi commented Aug 28, 2023

  • run pnpm dlx prisma migrate dev --schema ../../packages/prisma/prisma/schema.prisma

I would do this instead (looks simpler):

cd ../../packages/prisma
pnpm dlx prisma migrate dev

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.

2 participants