Skip to content

Commit

Permalink
Default timestamptz
Browse files Browse the repository at this point in the history
jonatas committed Dec 5, 2024
1 parent 401aba4 commit 9073fbc
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@
Dotenv.load! if File.exist?(".env")

# Establish a connection for testing
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.datetime_type = :timestamptz


ActiveRecord::Base.establish_connection(ENV['PG_URI_TEST'])
Timescaledb.establish_connection(ENV['PG_URI_TEST'])
4 changes: 2 additions & 2 deletions spec/support/active_record/schema.rb
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ def setup_tables
create_table(:events, id: false, hypertable: hypertable_options) do |t|
t.string :identifier, null: false
t.jsonb :payload
t.timestamptz :created_at
t.datetime :created_at
end

create_table(:hypertable_with_options, id: false, hypertable: {
@@ -19,7 +19,7 @@ def setup_tables
if_not_exists: true
}) do |t|
t.serial :id, primary_key: false
t.timestamptz :ts
t.datetime :ts
t.string :identifier
t.index [:id, :ts], name: "index_hypertable_with_options_on_id_and_ts"
end
4 changes: 2 additions & 2 deletions spec/timescaledb/toolkit_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -205,7 +205,7 @@
con.create_table :measurements, hypertable: hypertable_options, id: false do |t|
t.integer :device_id
t.decimal :val
t.timestamp :ts
t.datetime :ts
end
end

@@ -289,7 +289,7 @@
t.text :symbol
t.decimal :price
t.decimal :volume
t.timestamp :time
t.datetime :time
end
end

0 comments on commit 9073fbc

Please sign in to comment.