Sha256: c2c69d9f5cd03eeae212042b9585d774753876fe39fd7fd01ebf6b5938c0f587

Contents?: true

Size: 582 Bytes

Versions: 5

Compression:

Stored size: 582 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/setup"
require "timescaledb"

def uri_from_test
  require 'dotenv'
  Dotenv.load!
  ENV['PG_URI_TEST']
end

ActiveRecord::Base.establish_connection(ARGV[0] || uri_from_test)

Timescaledb::Hypertable.find_each do |hypertable|
  class_name = hypertable.hypertable_name.singularize.camelize

  model = Class.new(ActiveRecord::Base) do
    self.table_name = hypertable.hypertable_name
    self.primary_key = self.column_names.first

    acts_as_hypertable
  end

  Timescaledb.const_set(class_name, model)
end

require "pry"
Pry.start(Timescaledb)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
timescaledb-0.2.6 bin/console
timescaledb-0.2.5 bin/console
timescaledb-0.2.4 bin/console
timescaledb-0.2.3 bin/console
timescaledb-0.2.2 bin/console