Sha256: f435e3bcae6004821eb2eaf9fc5253c6e82fb8ab98a150aaf488857c54d09d66

Contents?: true

Size: 752 Bytes

Versions: 50

Compression:

Stored size: 752 Bytes

Contents

begin
  require "dynomite"
rescue LoadError # Commands::Base.eager_load
  nil
end

class Jets::Commands::Dynamodb::Migrator
  def initialize(path, options)
    @path = path
    @options = options
  end

  def run
    puts "Running database migrations"
    return if @options[:noop]
    migrate
  end

  def migrate
    path = "#{Jets.root}/#{@path}"
    unless File.exist?(path)
      puts "Unable to find the migration file: #{path}"
      exit 1 unless ENV['TEST']
    end

    require path
    migration_class = get_migration_class
    migration_class.new.up
  end

  def get_migration_class
    filename = File.basename(@path, '.rb')
    filename = filename.sub(/\d+[-_]/, '') # strip leading timestsamp
    filename.camelize.constantize
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
jets-2.0.1 lib/jets/commands/dynamodb/migrator.rb
jets-2.0.0 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.32 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.31 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.30 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.29 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.28 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.27 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.26 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.25 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.24 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.23 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.22 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.21 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.20 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.19 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.18 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.17 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.16 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.15 lib/jets/commands/dynamodb/migrator.rb