Module: OsUp
- Defined in:
- lib/osup.rb,
lib/osup/cli.rb,
lib/osup/version.rb,
lib/osup/cli/main.rb,
lib/osup/migrator.rb,
lib/osup/migration.rb,
lib/osup/cli/runner.rb,
lib/osup/exceptions.rb,
lib/osup/cli/command.rb,
lib/osup/system_state.rb,
lib/osup/migration_list.rb,
lib/osup/pool_migrations.rb
Defined Under Namespace
Modules: Cli Classes: Migration, MigrationList, Migrator, PoolInUse, PoolIncompatible, PoolMigrations, PoolUpToDate, SystemState
Constant Summary collapse
- VERSION =
'24.05.0'.freeze
Class Method Summary collapse
-
.init(pool, force: false) ⇒ Object
Initialize pool.
- .migration_dir ⇒ Object
-
.rollback(pool, **opts) ⇒ Object
Rollback pool.
- .root ⇒ Object
-
.upgrade(pool, **opts) ⇒ Object
Upgrade pool.
Class Method Details
.init(pool, force: false) ⇒ Object
Initialize pool
44 45 46 47 48 49 50 51 52 |
# File 'lib/osup.rb', line 44 def self.init(pool, force: false) pool_migrations = PoolMigrations.new(pool) if pool_migrations.applied.any? && !force raise PoolInUse, pool_migrations end pool_migrations.set_all_up end |
.migration_dir ⇒ Object
58 59 60 |
# File 'lib/osup.rb', line 58 def self.migration_dir File.join(root, 'migrations') end |
.rollback(pool, **opts) ⇒ Object
Rollback pool
31 32 33 34 35 36 37 38 39 |
# File 'lib/osup.rb', line 31 def self.rollback(pool, **opts) pool_migrations = PoolMigrations.new(pool) Migrator.rollback( pool_migrations, to: opts[:to], dry_run: opts[:dry_run] ) end |
.root ⇒ Object
54 55 56 |
# File 'lib/osup.rb', line 54 def self.root File.join(__dir__, '..') end |
.upgrade(pool, **opts) ⇒ Object
Upgrade pool
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/osup.rb', line 9 def self.upgrade(pool, **opts) pool_migrations = PoolMigrations.new(pool) if !pool_migrations.upgradable? raise PoolIncompatible, pool_migrations elsif pool_migrations.uptodate? raise PoolUpToDate, pool_migrations end Migrator.upgrade( pool_migrations, to: opts[:to], dry_run: opts[:dry_run] ) end |