Sha256: 282afee0f9ebe65e1f7b59cc09fb5d4e8fc80f801ffe42cb8e588975cec07db3
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
require 'fileutils' require 'active_record' require 'ardb/runner' require 'ardb/migration_helpers' class Ardb::Runner::MigrateCommand attr_reader :migrations_path, :version, :verbose def initialize @adapter = Ardb::Adapter.send(Ardb.config.db.adapter) @migrations_path = Ardb.config.migrations_path @version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil @verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true end def run begin Ardb.init migrate_the_db rescue Ardb::Runner::CmdError => e raise e rescue Exception => e $stderr.puts "error migrating #{Ardb.config.db.database.inspect} database" $stderr.puts e $stderr.puts e.backtrace raise Ardb::Runner::CmdFail end end def migrate_the_db if defined?(ActiveRecord::Migration::CommandRecorder) ActiveRecord::Migration::CommandRecorder.class_eval do include Ardb::MigrationHelpers::RecorderMixin end end ActiveRecord::Migrator.migrations_path = @migrations_path ActiveRecord::Migration.verbose = @verbose ActiveRecord::Migrator.migrate(@migrations_path, @version) do |migration| ENV["SCOPE"].blank? || (ENV["SCOPE"] == migration.scope) end @adapter.dump_schema end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ardb-0.24.0 | lib/ardb/runner/migrate_command.rb |
ardb-0.23.0 | lib/ardb/runner/migrate_command.rb |
ardb-0.22.1 | lib/ardb/runner/migrate_command.rb |