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

Update connection to work for multi-keyspace databases #23

Merged
merged 1 commit into from
Apr 1, 2024

Conversation

mscoutermarsh
Copy link
Member

By setting database to @primary, all DDL will be routed by vitess to the correct keyspace.

Previously, by setting database, we were targeting a single keyspace by default.

With the @primary change, any changes to existing tables will be routed correctly. When using create_table, the keyspace still needs to be specified. Will do a follow up PR to make creating tables easier.

I also explored leaving it nil. The problem with that is: Rails will fallback to whatever is set in database.yml. Which overrides the nil and sets a database name for us. Using @primary makes everything just work without any database.yml hacks.

By setting database to `@primary`, all subsequent DDL will be routed by vitess to the correct keyspace.

Previously, by setting `database`, we were targeting a single keyspace by default.

With the `@primary` change, any changes to existing tables will be routed correctly.
When using `create_table`, the keyspace still needs to be specified.
Will do a follow up PR to make creating tables easier.
@mscoutermarsh mscoutermarsh merged commit 85e7828 into main Apr 1, 2024
5 checks passed
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.

4 participants