Sha256: 79ee1dac1de1b343db7215d725c32f91bbaf48dec5f946a1dc787be1dbb1f27c

Contents?: true

Size: 752 Bytes

Versions: 32

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.classify.constantize
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
jets-1.9.4 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.3 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.2 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.1 lib/jets/commands/dynamodb/migrator.rb
jets-1.9.0 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.14 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.13 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.12 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.11 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.10 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.9 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.8 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.7 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.6 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.5 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.4 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.3 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.2 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.1 lib/jets/commands/dynamodb/migrator.rb
jets-1.8.0 lib/jets/commands/dynamodb/migrator.rb