-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Cockroach DB for v5 #20373
Cockroach DB for v5 #20373
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Excited to see this moving forward 😄 One thing to note (and maybe you've already looked in to it), but the client may need to retry for highly concurrent tables and entries. CRDB can return an "error" that's basically just a request that the client retries its transaction. Knex may handle that for you already though. |
Hi @cpaczek thank you for all the hard work on this. Currently we cannot merge this into the main repo as we do not have the capacity to maintain this extra dialect. We are looking at ways to open an API/config so someone could install such a dialect as a package and use it. Hopefully we can propose sth for v5 🙌 |
Understandable, for reference for what an API would need to support these were the main things that needed to be changed/added in order to get cockroach to work. the rest is just copy and pasted from postgres config. Changing sql_sequence and transaction isolation level to more closely mimic postgres (sql_seqence might not need to be changed since v5 now uses uid but haven't tested this) Use the string_to_array function to get over the limitations of 2d arrays. Pass CockroachDB into knex The main reason it took this long to make cockroach compatible with Strapi is mainly because of the transaction isolation level but cockroach now has official support for READ COMMITTED isolation level which makes it mimic default postgres behavior. I'm not sure how helpful building out an API for this would be as adding any dialect that isn't support by knex would be impossible and relying on 3rd party devs would reduce reliability since the database is such a critical system unlike a plugin. |
Was also talking with @derrickmehaffy and if we wanted to have dialects be external packages and it would be relatively simple Have this respect "custom" dialects from the config strapi/packages/core/database/src/connection.ts Lines 15 to 23 in fadd408
Then have this file load the external package from the db config strapi/packages/core/database/src/dialects/index.ts Lines 11 to 24 in fadd408
so the config would look something like this
and cockroach-strapi would just include the dialect index.ts and schema-inspector which is where all the changes are Also Move this logic to dialect instead of being scattered around the codebase |
Yup you summarized well what I had in mind if we go this route 👍 |
if yall do decide to go this route I could take a crack at it in a new PR. Not sure if you'd want to do an RFC first tho. Could easily do it without breaking changes. |
If you fill like it that sounds great to do a draft. do you want to propose a mini spec here 1st ? so we can validate before you go ahead :D |
Since cockroach is no longer open source, probably best not to integrate with them. Sorry @cpaczek https://news.itsfoss.com/cockcroachdb-no-open-source/ https://www.cockroachlabs.com/blog/enterprise-license-announcement/?ref=news.itsfoss.com |
CRDB is finally working with Strapi, passing all tests, documentation written, and ready for review.
to test use the following docker-compose file and connection config.
Docker Compose