Module: Clickhouse::Migrator
- Defined in:
- lib/clickhouse/migrator.rb
Class Method Summary collapse
Class Method Details
.migrate(to: nil) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/clickhouse/migrator.rb', line 8 def migrate(to: nil) if to.present? migrator(target: to.to_i).run else migrator.run end end |
.migrator(**opts) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/clickhouse/migrator.rb', line 21 def migrator(**opts) Sequel::TimestampMigrator.new( DB, Rails.root.join("db/migrate/clickhouse"), table: :clickhouse_migrations, use_transactions: false, **opts, ) end |
.rollback(to: nil) ⇒ Object
16 17 18 19 |
# File 'lib/clickhouse/migrator.rb', line 16 def rollback(to: nil) target = to || migrator.applied_migrations.reverse[1] migrator(target: target.to_i).run end |