Skip to content
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

CockroachDB detects crdb_internal_region changes #5109

Closed
kshinn opened this issue Jan 8, 2025 · 2 comments
Closed

CockroachDB detects crdb_internal_region changes #5109

kshinn opened this issue Jan 8, 2025 · 2 comments

Comments

@kshinn
Copy link

kshinn commented Jan 8, 2025

There is an issue with CockroachDB after recent changes from their engine.

From what I can tell so far (after a couple hours of spelunking through the code), is that there is either an issue with the shadow_database creation or the table selection SQL statement is detecting more than it should. This is a problem that exists in both multi-region as well as single-region databases. The enum will exist in both cases; in the single region case, it just has one entry.

Prism should probably ignore the internal fields like this as they are mostly controlled through the configuration of the database and should not be managed by a schema.

There was a bug filed on the main prisma repo, but I believe the issue exists here in the engine. I opened a PR (#5108) that tries to restrict some of the data returning from the namespaces to skip internal tables, but I'm not convinced this is the right approach for the fix. There may be something in the Rust code that can ignore certain table pattern name (i.e. crdb_internal_*)

Quote from the original ticket:

Drift detected: Your database schema is not in sync with your migration history.

[-] Removed enums

crdb_internal_region
? We need to reset the CockroachDB database "defaultdb" at "your-cluster-url.cloud:26257"

This issue started occurring around November 8th, 2024. Prior to this, migrations were working correctly. The problem seems to be related to the introduction of the crdb_internal_region enum in CockroachDB's multi-region clusters, which causes Prisma to detect schema drift and fail the migration.

@kshinn
Copy link
Author

kshinn commented Jan 8, 2025

I'm happy to try and contribute this fix if I can get some guidance on where to focus.

@jkomyno
Copy link
Contributor

jkomyno commented Jan 13, 2025

Hey @kshinn, we're closing this in favor of prisma/prisma#25696.
We want to centralise all prisma / @prisma/client issues under the https://github.com/prisma/prisma repository.

As for your PR, thank you for that. Be advised that it may take us some time to review it, as we're currently focused on other features and improvements that align with the needs of consumers of more popular databases.

For more insight into our priorities and how we’re thinking about the future of Prisma, please see our blog post: https://www.prisma.io/blog/prisma-orm-manifesto.

Thank you for your understanding and support!

@jkomyno jkomyno closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2025
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

No branches or pull requests

2 participants