jonatas / timescaledb

The timescaledb gem. Pack of helpers to work with TimescaleDB extension in Ruby.
https://jonatas.github.io/timescaledb/
MIT License
61 stars 18 forks source link

Excluding create_schema from schema.rb #57

Closed g-langlois closed 5 months ago

g-langlois commented 6 months ago

Hi,

I have an issue when dumping the schema using db:schema:dump

ActiveRecord::Schema[7.1].define(version: 2024_01_30_201037) do
  create_schema "_timescaledb_cache"
  create_schema "_timescaledb_catalog"
  create_schema "_timescaledb_config"
  create_schema "_timescaledb_functions"
  create_schema "_timescaledb_internal"
  create_schema "timescaledb_experimental"
  create_schema "timescaledb_information"
  create_schema "toolkit_experimental"

Those calls to create_schema create an issue when calling db:test:prepare because those schema already exist on new database. I am using the docker version of timescaledb timescale/timescaledb:2.14.2-pg15.

Is there a way that we could modify the schema dumper from this gem, so that it excludes those create_schema?

jonatas commented 6 months ago

Hello @g-langlois , this looks something new. As far as I got latest tests it was not exposing such schemas in the dump.

That's first time I see it. Are you on rails 7.1? I think I need to write a small POC to check it in action.

g-langlois commented 6 months ago

Yes, I am on 7.1. I can't comment about the previous version. Prior to 7.1, I was using structure.sql, but the behavior changed from Rails (not possible anymore to exclude based on a pattern matcher) and I now have to use schema.rb.