Skip to content

Conversation

@calmacleod
Copy link

@calmacleod calmacleod commented Nov 21, 2025

Resolve Scenic Integration Causes Issues with Multiple Databases by adding optional configuration block with option to disable Scenic integration

@CLAassistant
Copy link

CLAassistant commented Nov 21, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@murrayju murrayju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the submission! Just a bit of feedback, if you don't mind addressing it.

@calmacleod
Copy link
Author

calmacleod commented Dec 22, 2025

@murrayju Please note that I also bumped some tool versions to ensure that the project is up to date when running the tests locally.

For what it's worth, to get all the tests running locally, I had to make some changes to some surrounding code. I haven't committed it yet but it may be worth it to get it included.

Specifically the test helper teardown_tables doesn't properly handle dropping materialized views and the ContinuousAggregates model doesn't seem to scope jobs/chunks properly in it's has_many relationships.

diff --git a/lib/timescaledb/continuous_aggregates.rb b/lib/timescaledb/continuous_aggregates.rb
index 5c4e61f..85d4293 100644
--- a/lib/timescaledb/continuous_aggregates.rb
+++ b/lib/timescaledb/continuous_aggregates.rb
@@ -3,11 +3,15 @@ module Timescaledb
     self.table_name = "timescaledb_information.continuous_aggregates"
     self.primary_key = 'materialization_hypertable_name'
 
-    has_many :jobs, foreign_key: "hypertable_name",
-      class_name: "Timescaledb::Job"
+    has_many :jobs,
+    foreign_key: "hypertable_name",
+    primary_key: "view_name",
+    class_name: "Timescaledb::Job"
 
-    has_many :chunks, foreign_key: "hypertable_name",
-      class_name: "Timescaledb::Chunk"
+    has_many :chunks,
+    foreign_key: "hypertable_name",
+    primary_key: "materialization_hypertable_name",
+    class_name: "Timescaledb::Chunk"
 
     scope :resume, -> do
       {
diff --git a/spec/support/active_record/schema.rb b/spec/support/active_record/schema.rb
index 6924962..b0a2a91 100644
--- a/spec/support/active_record/schema.rb
+++ b/spec/support/active_record/schema.rb
@@ -36,6 +36,10 @@ def setup_tables
 end
 
 def teardown_tables
+  Timescaledb::ContinuousAggregates.all.each do |continuous_aggregate|
+    ActiveRecord::Base.connection.execute("DROP MATERIALIZED VIEW IF EXISTS #{continuous_aggregate.view_name} CASCADE")
+  end
+
   ActiveRecord::Base.connection.tables.each do |table|
     ActiveRecord::Base.connection.drop_table(table, force: :cascade)
   end

@calmacleod calmacleod requested a review from murrayju December 22, 2025 19:38
@murrayju
Copy link
Member

@calmacleod lets get the tests to pass in this PR. Please add your fixes

@calmacleod
Copy link
Author

@murrayju The PR has been updated with the following:

  • Updated bundler + gem version to take care of deprecation warnings
  • Updated the Schema Dumper spec to account for newer Active Record 8.1 method definitions
  • Added new testing.md document with detailed explanations for how the test suite can be run.

@murrayju
Copy link
Member

Thanks @calmacleod. It looks like the tests are still failing in the checks here. Can you take another look?

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.

Scenic Integration Causes Issues with Multiple Databases

3 participants