Skip to content

How to upgrade timescale in a Rails application #111

@exterm

Description

@exterm

I'm unsure how to do timescale updates in Rails. There is a Timescaledb::Extension.update! but it does not work. I guess I would have to have a migration that does something like

ApplicationRecord.connection.execute('ALTER EXTENSION timescaledb UPDATE')

?

I tried to execute that last statement in the console, but it didn't work:

/usr/local/bundle/ruby/3.4.0/gems/activerecord-8.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in 'PG::Connection#exec': ERROR:  extension "timescaledb" cannot be updated after the old version has already been loaded (PG::FeatureNotSupported)
HINT:  Start a new session and execute ALTER EXTENSION as the first command. Make sure to pass the "-X" flag to psql.

I assume it would also not work in a migration since it would not be the first statement executed. I'm working on making the update part of an initialization script for my docker container (we're using Kamal to manage the production deployment of Timescale).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions