activerecord-cockroachdb-adapter icon indicating copy to clipboard operation
activerecord-cockroachdb-adapter copied to clipboard

crdb_region and the database name shows up in the schema file

Open mmalek-sa opened this issue 1 year ago • 1 comments

When using regional by row tables, crdb_region shows up in the schema file and it also has the development database name in the primary region definition. For example:

t.enum "crdb_region", default: -> { "default_to_database_primary_region(gateway_region())::app1_development.public.crdb_internal_region" }, null: false, enum_type: "crdb_internal_region", hidden: true

As a workaround, we have to patch column_definitions method in the adapter to hide the crdb_region definition completely.

def column_definitions(table_name)
  fields = super
  fields.reject { |field| field.first == "crdb_region" }
end

Is there a reason behind dumping hidden crdb_region column in the schema with a hardcoded database name?

P.S. Adapter version 7.2 with Rails 7.2.

mmalek-sa avatar Oct 07 '24 17:10 mmalek-sa

I think we should close this in favor of #344 and #338. Have you had a chance to see if these issues are related to yours ? And isn't the PR #345 fixing it ?

BuonOmo avatar Oct 08 '24 08:10 BuonOmo