Class: DataMigrate::Data

Inherits:
ActiveRecord::Schema
  • Object
show all
Defined in:
lib/data_migrate/data_schema.rb

Overview

Provides the definition method for data_schema.rb

Instance Method Summary collapse

Instance Method Details

#define(info) ⇒ Object

This method is based on the following two methods

ActiveRecord::Schema#define
ActiveRecord::ConnectionAdapters::SchemaStatements
  #assume_migrated_upto_version


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/data_migrate/data_schema.rb', line 11

def define(info)
  DataMigrate::DataMigrator.assure_data_schema_table

  return if info[:version].blank?

  version = info[:version].to_i

  unless migrated.include?(version)
    execute "INSERT INTO #{sm_table} (version) VALUES ('#{version}')"
  end

  insert(version)
end