Class: NeoGruby::Sequel::CLI::Migrate
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- NeoGruby::Sequel::CLI::Migrate
- Defined in:
- lib/neo_gruby/sequel/cli/sequel.rb
Instance Method Summary collapse
Instance Method Details
#call(version: nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/neo_gruby/sequel/cli/sequel.rb', line 11 def call(version: nil, **) require './config/boot' require 'sequel' require 'yaml' ::Sequel.extension :migration config = YAML.load_file(NeoGruby.root.join('config', 'database.yml')) config[NeoGruby.env].keys.each do |name| dir = NeoGruby.root.join('db/migrations', name) puts dir if File.directory? dir ::Sequel::Migrator.run(NeoGruby.db[name.to_sym], dir, target: version) if File.directory? dir end end |