-
Notifications
You must be signed in to change notification settings - Fork 52
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
Incorrect db/schema.rb file for Postgres when using Cockroach and Postgres together. #251
Comments
@jviney thanks for reporting the bug. I could indeed reproduce it (repo here) with this default: &default
primary:
adapter: postgresql
database: foo
other:
adapter: cockroachdb
database: bar
port: 26257
host: localhost
user: root
development:
<<: *default
test:
<<: *default
production:
<<: *default Here is the culprit PR: #44. I think we are monkeypatching because there is no specific place where we are using this class in the codebase ( Worst case scenario, we can use the content of your hack since it seems to work both for pg and cockroach. |
We used to monkeypatch freely some classes. However, Rails is now supporting multiple databases, and these patches are in the way of this usage. Fixes #251
We used to monkeypatch freely some classes. However, Rails is now supporting multiple databases, and these patches are in the way of this usage. Fixes #251
We used to monkeypatch freely some classes. However, Rails is now supporting multiple databases, and these patches are in the way of this usage. Fixes #251
In our Rails app we use both Postgres and Cockroach at the same time with Rails 6 multi-database support.
This adapter monkey patches
ActiveRecord::ConnectionAdapters::PostgreSQL::Column#serial?
in a way that causes the Postgresdb/schema.rb
file to be incorrectly generated, with primary key values like:Instead of:
We've applied this patch below to fix the issue so that the
@serial
value is still respected when it's been supplied for Postgres columns.What's the reason for the CockroachDB adapter monkey patching the PostgresSQL::Column class instead of creating a subclass?
The text was updated successfully, but these errors were encountered: