Sha256: 693a2737d868eba7dd862fad41afbfc4c327950fbd10a1efe0e9e6da54d166d6

Contents?: true

Size: 732 Bytes

Versions: 91

Compression:

Stored size: 732 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
    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

91 entries across 91 versions & 1 rubygems

Version Path
jets-1.4.8 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.7 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.6 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.5 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.4 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.3 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.2 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.1 lib/jets/commands/dynamodb/migrator.rb
jets-1.4.0 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.9 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.8 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.7 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.6 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.5 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.4 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.3 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.2 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.1 lib/jets/commands/dynamodb/migrator.rb
jets-1.3.0 lib/jets/commands/dynamodb/migrator.rb
jets-1.2.1 lib/jets/commands/dynamodb/migrator.rb