Sha256: 57429d2b8a39df06a668c30bacad5561264c7a637c5b2cf725d7f0fd0eaaf868

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

#!/usr/bin/env ruby

require "bundler/setup"
require "timescale"

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

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

Timescale::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
    include Timescale::HypertableHelpers
  end
  Timescale.const_set(class_name, model)
end

require "pry"
Pry.start(Timescale)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
timescaledb-0.1.0 bin/console