P
Prisma•2mo ago
Broken Yolk

Migration to v6 Cockroach DB

I am working on my local environment on a project that uses Prisma. The config looks like this:
generator client {
provider = "prisma-client-js"
output = "../node_modules/@internal/prisma-configuration/client"
}

datasource db {
provider = "cockroachdb"
url = env("DB_CONNECTION_URL")
}
generator client {
provider = "prisma-client-js"
output = "../node_modules/@internal/prisma-configuration/client"
}

datasource db {
provider = "cockroachdb"
url = env("DB_CONNECTION_URL")
}
The prisma-configuration client is the client for the configuration service in a Turborepo. We have more services, all with their own Prisma clients. After upgrading from version 5 to version 6, nothing happens when I run npx prisma migrate dev --name upgrade-to-v6. It doesn't automatically change the structure of the tables that manage implicit relationships, even though I have multiple of these tables. When I inspect my database tables, they all still have the structure as before, with unique constraint on columns A and B. That leaves me with a couple of questions: - Does the automatic migration only work for PostgreSQL and not for CockroachDB? - If you can confirm that this does not work automatically, should I continue by creating the migration manually? - Or can I skip this step for CockroachDB? Since I would have to do it manually after adding any implicit m-to-n relationship.
4 Replies
Prisma AI Help
Prisma AI Help•2mo ago
You've gone full bot mode! Let me fetch that AI answer for you ASAP. Based on the information provided in the knowledge sources, I don't have enough specific details to fully answer your question about automatic migration for CockroachDB in Prisma 6. However, I can provide some relevant information and suggestions: 1. CockroachDB support in Prisma: CockroachDB is supported by Prisma, but it's important to note that there have been some limitations and differences compared to PostgreSQL support. 2. Migration issues: There have been reported issues with Prisma migrations on CockroachDB in the past. For example, Github Issue: Prisma migrate always DROP DEFAULT on CockroachDB discusses problems with migrations dropping default values unexpectedly. 3. Version-specific changes: The upgrade from Prisma 5 to 6 might have introduced changes in how migrations work, especially for CockroachDB. However, the knowledge sources don't provide specific information about Prisma 6 and CockroachDB migrations. 4. Provider specification: As of Prisma 5, it became required to use the cockroachdb provider explicitly when connecting to a CockroachDB database, as mentioned in the Prisma 5 Upgrade Guide. Your schema correctly uses this provider. 5. Implicit relationships: The knowledge sources don't contain information about automatic migration of implicit relationships specifically for CockroachDB in Prisma 6. Given the lack of specific information about Prisma 6 and CockroachDB migrations in the knowledge sources, I recommend the following steps: 1. Check the Prisma documentation for any CockroachDB-specific migration instructions for version 6. 2. If the issue persists, consider opening an issue on the Prisma GitHub repository to get more specific guidance from the Prisma team. 3. As a workaround, you might need to manually adjust your schema or write custom migration scripts to achieve the desired table structure changes. If you need more detailed information or a definitive answer about automatic migrations for CockroachDB in Prisma 6, it would be best to consult the latest Prisma documentation or reach out to Prisma support directly. 🤔 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.
RaphaelEtim
RaphaelEtim•2mo ago
Hi @Broken Yolk Thank you for raising this question. I'm checking with the engineering team for your questions and will provide an update as soon as i have one Hi @Broken Yolk I got confirmation from the team that the change only applies to Postgres. Cockroach DB users do not need to do anything.
Broken Yolk
Broken YolkOP•2mo ago
Awesome, thanks a lot for the fast reply!
RaphaelEtim
RaphaelEtim•2mo ago
You're welcome

Did you find this page helpful?