Sha256: 7884c2ffe6c4df36d41bce2a54e29ce355cdaa7fe77f2cfd6e320b186ac796b9

Contents?: true

Size: 755 Bytes

Versions: 66

Compression:

Stored size: 755 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 Jets.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

66 entries across 66 versions & 2 rubygems

Version Path
jets-4.0.12 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.11 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.10 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.9 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.8 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.7 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.6 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.5 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.4 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.3 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.2 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.1 lib/jets/commands/dynamodb/migrator.rb
jets-4.0.0 lib/jets/commands/dynamodb/migrator.rb
jets-3.2.2 lib/jets/commands/dynamodb/migrator.rb
jets-3.2.1 lib/jets/commands/dynamodb/migrator.rb
jets.benforeva-3.0.17.pre.mount.pre.fix lib/jets/commands/dynamodb/migrator.rb
jets-3.2.0 lib/jets/commands/dynamodb/migrator.rb
jets-3.1.5 lib/jets/commands/dynamodb/migrator.rb
jets-3.1.4 lib/jets/commands/dynamodb/migrator.rb
jets-3.1.3 lib/jets/commands/dynamodb/migrator.rb