P
Prismaā€¢2mo ago
hari_narayan

Gi,Migration 2 shemafiles...schma1.prisma

Respected sir, shema1.prisma and shema2.prisma Fules how to generate migration files for both in seperate folders....what cli command i can use #migrations Prisma folder in that this two files exists.... Thanks
6 Replies
Prisma AI Help
Prisma AI Helpā€¢2mo ago
You opted for speed from this bot. Let's conjure up an answer right now! Based on the knowledge sources provided, I can answer your question about generating migration files for two separate schema files in Prisma. Here's how you can do it: To generate migration files for two separate schema files (schema1.prisma and schema2.prisma) in different folders, you need to use the --schema flag with the prisma migrate dev command for each schema file. Here are the CLI commands you can use: For schema1.prisma:
npx prisma migrate dev --name initial_migration --schema ./path/to/schema1.prisma
npx prisma migrate dev --name initial_migration --schema ./path/to/schema1.prisma
For schema2.prisma:
npx prisma migrate dev --name initial_migration --schema ./path/to/schema2.prisma
npx prisma migrate dev --name initial_migration --schema ./path/to/schema2.prisma
Make sure to replace ./path/to/ with the actual path to your schema files. These commands will create separate migration folders for each schema file. The migrations will be stored in the migrations directory next to each schema file. It's important to note that this approach requires you to manage multiple Prisma clients and migration histories separately. Each schema file will have its own set of migrations. For more detailed information on working with multiple schemas and databases, you can refer to the Github issue discussion on Multiple Connections / Databases / Datasources. Remember that while this approach works, it's not the most convenient solution. Prisma is actively working on improving support for multiple databases and schemas. You might want to keep an eye on future updates that could simplify this process. šŸ¤” Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
hari_narayan
hari_narayanOPā€¢2mo ago
@Prisma AI Help find again please
RaphaelEtim
RaphaelEtimā€¢2mo ago
Hi @hari_narayan Did the cli commands suggested by the AI not work for your usecase?
hari_narayan
hari_narayanOPā€¢4w ago
@RaphaelEtim thanks to reply sir will try it...and let u know....šŸ™šŸ™ Yes For that |Prisma |-schema1 |----------shema1.shema |-shema2 |----------shema2.shema Folder structure needed thanks Then migration folders will be created smoothly...... Yes For that |Prisma |-schema1 |----------shema1.shema |-shema2 |----------shema2.shema |----------Migration |-------------------initialMig |---------------------mig.sql Like that above @RaphaelEtim thanks Yes but prisma migrate deploy is not happening..... Generated migration files but
RaphaelEtim
RaphaelEtimā€¢4w ago
Yes but prisma migrate deploy is not happening..... Generated migration files but
Can you please re-explain what you mean by prisma migrate deploy is not happening?
hari_narayan
hari_narayanOPā€¢3w ago
Yes its happening correctly...... Thanks..... Command like below --Npx prisma migrate deploy --shema ./path/to/shema2.prisma ..... But in documentation its not there......

Did you find this page helpful?