From 76775486b2c8e410251e754eb00e256223792700 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Fri, 21 Nov 2025 12:20:24 -0500 Subject: [PATCH 01/10] Make Scenic Integration Optional --- README.md | 23 ++++++++++-- lib/timescaledb.rb | 54 +++++++++++++++++++++++------ lib/timescaledb/configuration.rb | 30 ++++++++++++++++ lib/timescaledb/scenic/extension.rb | 2 -- 4 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 lib/timescaledb/configuration.rb diff --git a/README.md b/README.md index 92deca3..a9aa1cf 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,28 @@ gem install timescaledb ## Quick Start +### 1. Configuration + +Configuration options can be optionally passed in using an initializer. + +```ruby +# config/initializers/timescaledb.rb +Timescaledb.configure do |config| + # config.some_option = true +end +``` + +The following table includes all currently available configuration options: + +| Option | Supported Values | Default Value | Explanation | +|----------------------|---------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `scenic_integration` | `:enabled`
`:disabled` | `:enabled` | Controls whether the gem automatically integrates with the Scenic gem for managing database views. When set to :enabled (default), the gem will auto-detect if Scenic is available and configure it to work with TimescaleDB continuous aggregates. Set to :disabled to prevent automatic Scenic integration.

**Warning:** This integration may cause issues when used with multiple databases and one of the databases does not support TimescaleDB | + +### 2. Create Hypertables in the Active Record Migrations + The timescaledb gem provides helpers for creating hypertables, configuring compression, retention policies, and more. After adding the gem to your Gemfile, you can create hypertables in your migrations. -### 1. Create Hypertables in the Active Record Migrations - ```ruby class CreateEvents < ActiveRecord::Migration[7.0] def up @@ -61,7 +78,7 @@ class CreateEvents < ActiveRecord::Migration[7.0] end ``` -### 2. Enable TimescaleDB in Your Models +### 3. Enable TimescaleDB in Your Models You can enable TimescaleDB in your models by adding the `acts_as_hypertable` macro to your model. This macro extends your existing model with timescaledb-related functionality. diff --git a/lib/timescaledb.rb b/lib/timescaledb.rb index 60cde6c..22050e5 100644 --- a/lib/timescaledb.rb +++ b/lib/timescaledb.rb @@ -1,5 +1,8 @@ +# frozen_string_literal: true + require 'active_record' +require_relative 'timescaledb/configuration' require_relative 'timescaledb/application_record' require_relative 'timescaledb/acts_as_hypertable' require_relative 'timescaledb/acts_as_hypertable/core' @@ -22,6 +25,40 @@ require_relative 'timescaledb/version' module Timescaledb + class << self + def configure + self.configuration ||= Configuration.new + yield(configuration) if block_given? + end + + def configuration + @configuration ||= Configuration.new + end + + def setup_scenic_integration + return unless configuration.enable_scenic_integration? + return if @scenic_integration_setup + + begin + require 'scenic' + require_relative 'timescaledb/scenic/adapter' + require_relative 'timescaledb/scenic/extension' + + ::Scenic.configure do |config| + config.database = Timescaledb::Scenic::Adapter.new + end + + ::Scenic::Adapters::Postgres.include(Timescaledb::Scenic::Extension) + ::ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(Timescaledb::Scenic::MigrationHelpers) + + @scenic_integration_setup = true + rescue LoadError + # This is expected when the scenic gem is not being used + @scenic_integration_setup = false + end + end + end + module_function def connection @@ -65,15 +102,12 @@ def default_hypertable_options end end -begin - require 'scenic' - require_relative 'timescaledb/scenic/adapter' - require_relative 'timescaledb/scenic/extension' - - Scenic.configure do |config| - config.database = Timescaledb::Scenic::Adapter.new +# Delay scenic integration setup to respect user configuration when using Rails +if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load) + ActiveSupport.on_load(:active_record) do + Timescaledb.setup_scenic_integration end - -rescue LoadError - # This is expected when the scenic gem is not being used +else + # For non-Rails usage, setup immediately + Timescaledb.setup_scenic_integration end diff --git a/lib/timescaledb/configuration.rb b/lib/timescaledb/configuration.rb new file mode 100644 index 0000000..3db8a7e --- /dev/null +++ b/lib/timescaledb/configuration.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +class Configuration + attr_accessor :scenic_integration + + DEFAULTS = { + scenic_integration: :enabled + }.freeze + + def initialize + @scenic_integration = DEFAULTS[:scenic_integration] + end + + def enable_scenic_integration? + case @scenic_integration + when :enabled then scenic_detected? + else false # :disabled, :false, nil, etc. + end + end + + private + + def scenic_detected? + # Try to require scenic to see if it's available + require 'scenic' + true + rescue LoadError + false + end +end diff --git a/lib/timescaledb/scenic/extension.rb b/lib/timescaledb/scenic/extension.rb index e1efac7..4b08192 100644 --- a/lib/timescaledb/scenic/extension.rb +++ b/lib/timescaledb/scenic/extension.rb @@ -67,5 +67,3 @@ def create_scenic_continuous_aggregate(name) end -Scenic::Adapters::Postgres.include(Timescaledb::Scenic::Extension) -ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(Timescaledb::Scenic::MigrationHelpers) From 767558c85f112e4be95adcaf7c552bf54c802a24 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Mon, 22 Dec 2025 11:48:28 -0500 Subject: [PATCH 02/10] Review feedback --- lib/timescaledb.rb | 1 - lib/timescaledb/configuration.rb | 42 +++++++++++++++++--------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/timescaledb.rb b/lib/timescaledb.rb index 22050e5..a91b63c 100644 --- a/lib/timescaledb.rb +++ b/lib/timescaledb.rb @@ -27,7 +27,6 @@ module Timescaledb class << self def configure - self.configuration ||= Configuration.new yield(configuration) if block_given? end diff --git a/lib/timescaledb/configuration.rb b/lib/timescaledb/configuration.rb index 3db8a7e..592b725 100644 --- a/lib/timescaledb/configuration.rb +++ b/lib/timescaledb/configuration.rb @@ -1,30 +1,32 @@ # frozen_string_literal: true -class Configuration - attr_accessor :scenic_integration +module Timescaledb + class Configuration + attr_accessor :scenic_integration - DEFAULTS = { - scenic_integration: :enabled - }.freeze + DEFAULTS = { + scenic_integration: :enabled + }.freeze - def initialize - @scenic_integration = DEFAULTS[:scenic_integration] - end + def initialize + @scenic_integration = DEFAULTS[:scenic_integration] + end - def enable_scenic_integration? - case @scenic_integration - when :enabled then scenic_detected? - else false # :disabled, :false, nil, etc. + def enable_scenic_integration? + case @scenic_integration + when :enabled then scenic_detected? + else false # :disabled, :false, nil, etc. + end end - end - private + private - def scenic_detected? - # Try to require scenic to see if it's available - require 'scenic' - true - rescue LoadError - false + def scenic_detected? + # Try to require scenic to see if it's available + require 'scenic' + true + rescue LoadError + false + end end end From 3d37d3dcdd529921000e4503b2c11db7dfcc7faf Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Mon, 22 Dec 2025 11:48:41 -0500 Subject: [PATCH 03/10] Bump tool versions --- .tool-versions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.tool-versions b/.tool-versions index a9e31a4..d554c9c 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 2.7.1 +ruby 3.3.3 From f753728203d4c7fdc057a8297bae2e15fa13851c Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Mon, 22 Dec 2025 11:50:19 -0500 Subject: [PATCH 04/10] Bump tool versions --- Gemfile.lock | 6 +++--- Gemfile.scenic.lock | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 22cac8e..0ac0e73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - timescaledb (0.3.1) + timescaledb (0.3.2) activerecord activesupport ostruct @@ -33,8 +33,8 @@ GEM concurrent-ruby (~> 1.0) method_source (1.0.0) minitest (5.18.0) - ostruct (0.6.1) - pg (1.5.8) + ostruct (0.6.3) + pg (1.6.2) pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) diff --git a/Gemfile.scenic.lock b/Gemfile.scenic.lock index 3760260..98dab58 100644 --- a/Gemfile.scenic.lock +++ b/Gemfile.scenic.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - timescaledb (0.3.1) + timescaledb (0.3.2) activerecord activesupport ostruct @@ -57,8 +57,8 @@ GEM nokogiri (1.12.5) mini_portile2 (~> 2.6.1) racc (~> 1.4) - ostruct (0.6.1) - pg (1.5.9) + ostruct (0.6.3) + pg (1.6.2) pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) From 1789dc22b62db6ff4177442152f13589dfa4671b Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Mon, 22 Dec 2025 15:27:57 -0500 Subject: [PATCH 05/10] Fix dropping continuous aggregates for test suite --- spec/support/active_record/schema.rb | 4 ++++ 1 file changed, 4 insertions(+) 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 From 9697720d7655a175012df5effba08ac409253af4 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Mon, 22 Dec 2025 15:51:23 -0500 Subject: [PATCH 06/10] Update bundle + test fixes --- Gemfile.lock | 86 +++++++++++++++--------- lib/timescaledb/connection_handling.rb | 8 +-- lib/timescaledb/continuous_aggregates.rb | 3 +- spec/timescaledb/schema_dumper_spec.rb | 8 ++- 4 files changed, 65 insertions(+), 40 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0ac0e73..4c776c9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,53 +10,73 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (7.0.4.3) - activesupport (= 7.0.4.3) - activerecord (7.0.4.3) - activemodel (= 7.0.4.3) - activesupport (= 7.0.4.3) - activesupport (7.0.4.3) - concurrent-ruby (~> 1.0, >= 1.0.2) + activemodel (8.1.1) + activesupport (= 8.1.1) + activerecord (8.1.1) + activemodel (= 8.1.1) + activesupport (= 8.1.1) + timeout (>= 0.4.0) + activesupport (8.1.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + base64 (0.3.0) + bigdecimal (4.0.1) coderay (1.1.3) - concurrent-ruby (1.2.2) - database_cleaner-active_record (2.1.0) + concurrent-ruby (1.3.6) + connection_pool (3.0.2) + database_cleaner-active_record (2.2.2) activerecord (>= 5.a) - database_cleaner-core (~> 2.0.0) + database_cleaner-core (~> 2.0) database_cleaner-core (2.0.1) - diff-lcs (1.5.0) - dotenv (2.8.1) - gemika (0.8.1) - i18n (1.13.0) + diff-lcs (1.6.2) + dotenv (3.2.0) + drb (2.2.3) + gemika (1.0.0) + i18n (1.14.8) concurrent-ruby (~> 1.0) - method_source (1.0.0) - minitest (5.18.0) + json (2.18.0) + logger (1.7.0) + method_source (1.1.0) + minitest (6.0.0) + prism (~> 1.5) ostruct (0.6.3) pg (1.6.2) - pry (0.14.2) + prism (1.7.0) + pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) rake (12.3.3) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec (3.13.2) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.6) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-its (1.3.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) - rspec-mocks (3.12.5) + rspec-support (~> 3.13.0) + rspec-its (2.0.0) + rspec-core (>= 3.13.0) + rspec-expectations (>= 3.13.0) + rspec-mocks (3.13.7) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.6) + securerandom (0.4.1) + timeout (0.6.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + uri (1.1.1) PLATFORMS ruby @@ -72,4 +92,4 @@ DEPENDENCIES timescaledb! BUNDLED WITH - 2.2.31 + 4.0.2 diff --git a/lib/timescaledb/connection_handling.rb b/lib/timescaledb/connection_handling.rb index 7bf900c..5fcee32 100644 --- a/lib/timescaledb/connection_handling.rb +++ b/lib/timescaledb/connection_handling.rb @@ -2,12 +2,12 @@ module Timescaledb class ConnectionNotEstablishedError < StandardError; end module_function - + # @param [String] config with the postgres connection string. def establish_connection(config) # Establish connection for Timescaledb Connection.instance.config = config - + # Also establish connection for ActiveRecord if it's defined if defined?(ActiveRecord::Base) ActiveRecord::Base.establish_connection(config) @@ -17,12 +17,12 @@ def establish_connection(config) # @param [PG::Connection] to use it directly from a raw connection def use_connection(conn) Connection.instance.use_connection(conn) - + # Also set ActiveRecord connection if it's defined if defined?(ActiveRecord::Base) && ActiveRecord::Base.connected? ar_conn = ActiveRecord::Base.connection current_conn = ar_conn.raw_connection - + # Only set if it's different to avoid redundant assignment if current_conn != conn ar_conn.instance_variable_set(:@raw_connection, conn) diff --git a/lib/timescaledb/continuous_aggregates.rb b/lib/timescaledb/continuous_aggregates.rb index 5c4e61f..3fced54 100644 --- a/lib/timescaledb/continuous_aggregates.rb +++ b/lib/timescaledb/continuous_aggregates.rb @@ -3,8 +3,7 @@ class ContinuousAggregates < ::Timescaledb::ApplicationRecord 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" diff --git a/spec/timescaledb/schema_dumper_spec.rb b/spec/timescaledb/schema_dumper_spec.rb index be6fbca..2f92ace 100644 --- a/spec/timescaledb/schema_dumper_spec.rb +++ b/spec/timescaledb/schema_dumper_spec.rb @@ -71,7 +71,13 @@ let(:dump_output) do stream = StringIO.new - ActiveRecord::SchemaDumper.dump(con, stream) + # Rails 8+ uses connection_pool, older versions use connection + connection_arg = if ActiveRecord::VERSION::MAJOR >= 8 + ActiveRecord::Base.connection_pool + else + ActiveRecord::Base.connection + end + ActiveRecord::SchemaDumper.dump(connection_arg, stream) stream.string end From 53e5331d362eb5894d13dfa60c1395031e93cb94 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Mon, 22 Dec 2025 16:02:55 -0500 Subject: [PATCH 07/10] Add in test running instructions + silence active record --- docs/development/testing.md | 167 +++++++++++++++++++++++++++ lib/timescaledb/migration_helpers.rb | 2 +- mkdocs.yml | 1 + spec/spec_helper.rb | 2 + 4 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 docs/development/testing.md diff --git a/docs/development/testing.md b/docs/development/testing.md new file mode 100644 index 0000000..b8fba9b --- /dev/null +++ b/docs/development/testing.md @@ -0,0 +1,167 @@ +# Running the Test Suite + +This guide explains how to set up and run the test suite for the TimescaleDB Ruby gem. + +## Prerequisites + +### Ruby Version + +The test suite requires Ruby 3.3.3 (as specified in `.ruby-version`). The gem itself supports Ruby >= 2.3.0, but the test suite uses Ruby 3.3.3. + +You can use a Ruby version manager like `rbenv` or `rvm` to install and manage the correct version: + +```bash +# Using rbenv +rbenv install 3.3.3 +rbenv local 3.3.3 + +# Using rvm +rvm install 3.3.3 +rvm use 3.3.3 +``` + +### TimescaleDB Installation + +You need to have TimescaleDB installed and running. TimescaleDB is a PostgreSQL extension, so you'll need: + +1. PostgreSQL installed +2. TimescaleDB extension installed and enabled + +For installation instructions, see the [TimescaleDB documentation](https://docs.timescale.com/install/latest/). + +### Database Connection + +The test suite requires a PostgreSQL database with TimescaleDB enabled. You'll need to: + +1. Create a test database (if it doesn't exist) +2. Enable the TimescaleDB extension on that database +3. Set the `PG_URI_TEST` environment variable + +## Setup + +### 1. Install Dependencies + +```bash +bundle install +``` + +### 2. Configure Database Connection + +Set the `PG_URI_TEST` environment variable to point to your test database: + +```bash +export PG_URI_TEST="postgresql://username:password@localhost:5432/timescale_test" +``` + +Or create a `.env` file in the project root: + +```bash +PG_URI_TEST=postgresql://username:password@localhost:5432/timescale_test +``` + +The `.env` file will be automatically loaded by the test suite (via the `dotenv` gem). + +### 3. Create and Configure Test Database + +Create the test database and enable TimescaleDB: + +```bash +# Connect to PostgreSQL +psql -U postgres + +# Create the database +CREATE DATABASE timescale_test; + +# Connect to the test database +\c timescale_test + +# Enable TimescaleDB extension +CREATE EXTENSION IF NOT EXISTS timescaledb; +CREATE EXTENSION IF NOT EXISTS timescaledb_toolkit; +``` + +### 4. Setup Test Tables + +Before running tests, you need to set up the test tables. This will create the necessary hypertables and test fixtures: + +```bash +bundle exec rake test:setup +``` + +This command: +- Tears down any existing test tables +- Creates fresh test tables with the correct schema +- Sets up hypertables for testing + +**Note:** You should run `rake test:setup` whenever: +- You first set up the test environment +- The test schema changes +- Tests are failing due to missing or incorrect tables + +## Running Tests + +### Run All Tests + +```bash +bundle exec rspec +``` + +### Run Specific Test Files + +```bash +bundle exec rspec spec/timescaledb/migration_helper_spec.rb +``` + +### Run Specific Tests + +```bash +bundle exec rspec spec/timescaledb/migration_helper_spec.rb:114 +``` + +### Run Tests with Output + +By default, ActiveRecord SQL logging is silenced. To see SQL queries during tests, set the `DEBUG` environment variable: + +```bash +DEBUG=1 bundle exec rspec +``` + +### Run Only Failed Tests + +```bash +bundle exec rspec --only-failures +``` + +## Troubleshooting + +### Database Connection Errors + +If you see connection errors, verify: +- PostgreSQL is running +- The database exists +- TimescaleDB extension is enabled +- `PG_URI_TEST` is set correctly + +### Missing Tables Errors + +If tests fail with "table does not exist" errors, run: + +```bash +bundle exec rake test:setup +``` + +### TimescaleDB Extension Not Found + +If you see errors about TimescaleDB functions not being available: +- Verify TimescaleDB is installed: `psql -c "SELECT * FROM pg_extension WHERE extname = 'timescaledb';"` +- Ensure the extension is enabled on your test database +- Check that your PostgreSQL version is compatible with your TimescaleDB version + +## Continuous Integration + +The test suite is designed to work in CI environments. Make sure your CI configuration: + +1. Sets the `PG_URI_TEST` environment variable +2. Has TimescaleDB installed and enabled +3. Runs `bundle exec rake test:setup` before running tests + diff --git a/lib/timescaledb/migration_helpers.rb b/lib/timescaledb/migration_helpers.rb index c704176..104045f 100644 --- a/lib/timescaledb/migration_helpers.rb +++ b/lib/timescaledb/migration_helpers.rb @@ -48,7 +48,7 @@ def create_hypertable(table_name, **hypertable_options) original_logger = ActiveRecord::Base.logger - ActiveRecord::Base.logger = Logger.new(STDOUT) + ActiveRecord::Base.logger = Logger.new(STDOUT) unless original_logger.nil? dimension = "by_range(#{quote(time_column)}, #{parse_interval(chunk_time_interval)})" diff --git a/mkdocs.yml b/mkdocs.yml index b724d6b..be9aa0d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -33,4 +33,5 @@ nav: - Zooming with High Resolution: toolkit_lttb_zoom.md - Toolkit Candlesticks tutorial: toolkit_candlestick.md - Command Line: command_line.md + - Testing: development/testing.md - Videos: videos.md diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 994e6a8..79e8712 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,6 +16,8 @@ ActiveRecord::Base.establish_connection(ENV['PG_URI_TEST']) Timescaledb.establish_connection(ENV['PG_URI_TEST']) +ActiveRecord::Base.logger = ENV['DEBUG'] ? Logger.new(STDOUT) : nil + require_relative "support/active_record/models" require_relative "support/active_record/schema" From ddb1d3743ade207cbe48bc618dc19fc1fcfb3583 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Tue, 6 Jan 2026 13:59:01 -0500 Subject: [PATCH 08/10] Revert bundle version changes --- Gemfile.lock | 86 ++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 53 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4c776c9..0ac0e73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,73 +10,53 @@ PATH GEM remote: https://rubygems.org/ specs: - activemodel (8.1.1) - activesupport (= 8.1.1) - activerecord (8.1.1) - activemodel (= 8.1.1) - activesupport (= 8.1.1) - timeout (>= 0.4.0) - activesupport (8.1.1) - base64 - bigdecimal - concurrent-ruby (~> 1.0, >= 1.3.1) - connection_pool (>= 2.2.5) - drb + activemodel (7.0.4.3) + activesupport (= 7.0.4.3) + activerecord (7.0.4.3) + activemodel (= 7.0.4.3) + activesupport (= 7.0.4.3) + activesupport (7.0.4.3) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) - json - logger (>= 1.4.2) minitest (>= 5.1) - securerandom (>= 0.3) - tzinfo (~> 2.0, >= 2.0.5) - uri (>= 0.13.1) - base64 (0.3.0) - bigdecimal (4.0.1) + tzinfo (~> 2.0) coderay (1.1.3) - concurrent-ruby (1.3.6) - connection_pool (3.0.2) - database_cleaner-active_record (2.2.2) + concurrent-ruby (1.2.2) + database_cleaner-active_record (2.1.0) activerecord (>= 5.a) - database_cleaner-core (~> 2.0) + database_cleaner-core (~> 2.0.0) database_cleaner-core (2.0.1) - diff-lcs (1.6.2) - dotenv (3.2.0) - drb (2.2.3) - gemika (1.0.0) - i18n (1.14.8) + diff-lcs (1.5.0) + dotenv (2.8.1) + gemika (0.8.1) + i18n (1.13.0) concurrent-ruby (~> 1.0) - json (2.18.0) - logger (1.7.0) - method_source (1.1.0) - minitest (6.0.0) - prism (~> 1.5) + method_source (1.0.0) + minitest (5.18.0) ostruct (0.6.3) pg (1.6.2) - prism (1.7.0) - pry (0.15.2) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) rake (12.3.3) - rspec (3.13.2) - rspec-core (~> 3.13.0) - rspec-expectations (~> 3.13.0) - rspec-mocks (~> 3.13.0) - rspec-core (3.13.6) - rspec-support (~> 3.13.0) - rspec-expectations (3.13.5) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.13.0) - rspec-its (2.0.0) - rspec-core (>= 3.13.0) - rspec-expectations (>= 3.13.0) - rspec-mocks (3.13.7) + rspec-support (~> 3.12.0) + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.13.0) - rspec-support (3.13.6) - securerandom (0.4.1) - timeout (0.6.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - uri (1.1.1) PLATFORMS ruby @@ -92,4 +72,4 @@ DEPENDENCIES timescaledb! BUNDLED WITH - 4.0.2 + 2.2.31 From 162ca854c365728600b3fc912985eed801e35ec5 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Tue, 6 Jan 2026 14:20:57 -0500 Subject: [PATCH 09/10] Add development docker compose --- docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..68851d6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,14 @@ +volumes: + timescaledb: + external: false + +services: + timescaledb: + image: timescale/timescaledb-ha:pg18 + volumes: + - timescaledb:/home/postgres/pgdata/data + environment: + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=timescaledb_test + ports: + - 5432:5432 \ No newline at end of file From 0e1c621b05ff3b768afa8b55e05ab7286969c5e5 Mon Sep 17 00:00:00 2001 From: Callum MacLeod Date: Tue, 6 Jan 2026 14:22:38 -0500 Subject: [PATCH 10/10] Update testing docs --- docs/development/testing.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/development/testing.md b/docs/development/testing.md index b8fba9b..549552a 100644 --- a/docs/development/testing.md +++ b/docs/development/testing.md @@ -157,6 +157,10 @@ If you see errors about TimescaleDB functions not being available: - Ensure the extension is enabled on your test database - Check that your PostgreSQL version is compatible with your TimescaleDB version +### Timescale Toolkit Not Installed + +Occasionally you may see numerous failures related to functions being undefined within TimescaleDB. To resolve this, ensure you have the [TimescaleDB Toolkit](https://github.com/timescale/timescaledb-toolkit) plugin installed and enabled + ## Continuous Integration The test suite is designed to work in CI environments. Make sure your CI configuration: