Skip to content

Commit

Permalink
Scenic extension prepend instead of include
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatas committed May 2, 2024
1 parent a8cfe05 commit f9a50be
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions docs/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,21 @@ If you're interested in candlesticks and need to get the OHLC values, take a loo
at the [toolkit ohlc](/toolkit_ohlc) function that do the same but through a
function that can be reusing candlesticks from smaller timeframes.

!!! note "Disable ddl transactions in your migration to start with data"

If you want to start `with_data: true`, remember that you'll need to
`disable_ddl_transaction!` in your migration file.

```ruby
class CreateTicks < ActiveRecord::Migration[6.0]
disable_ddl_transaction!

def change
create_continuous_aggregate('ohlc_1m', query, with_data: true)
# ...
end
end
```


[1]: https://ideia.me/timescale-continuous-aggregates-with-ruby
4 changes: 2 additions & 2 deletions lib/timescaledb/scenic/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ def create_scenic_continuous_aggregate(name)
end


Scenic::Adapters::Postgres.include(Timescaledb::Scenic::Extension)
ActiveRecord::ConnectionAdapters::AbstractAdapter.include(Timescaledb::Scenic::MigrationHelpers)
Scenic::Adapters::Postgres.prepend(Timescaledb::Scenic::Extension)
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(Timescaledb::Scenic::MigrationHelpers)

0 comments on commit f9a50be

Please sign in to comment.