class ActiveRecord::SchemaMigration - activerecord-4.2.5.2 Documentation

# class ActiveRecord::SchemaMigration

### Public Class Methods

create_table(limit=nil) click to toggle source

    # File lib/active_record/schema_migration.rb, line 24
    def create_table(limit=nil)
      unless table_exists?
        version_options = {null: false}
        version_options[:limit] = limit if limit

        connection.create_table(table_name, id: false) do |t|
          t.column :version, :string, version_options
        end
        connection.add_index table_name, :version, unique: true, name: index_name
      end
    end

drop_table() click to toggle source

    # File lib/active_record/schema_migration.rb, line 36
    def drop_table
      if table_exists?
        connection.remove_index table_name, name: index_name
        connection.drop_table(table_name)
      end
    end

index_name() click to toggle source

    # File lib/active_record/schema_migration.rb, line 16
    def index_name
      "#{table_name_prefix}unique_#{ActiveRecord::Base.schema_migrations_table_name}#{table_name_suffix}"
    end

normalize_migration_number(number) click to toggle source

    # File lib/active_record/schema_migration.rb, line 43
    def normalize_migration_number(number)
      "%.3d" % number.to_i
    end

normalized_versions() click to toggle source

    # File lib/active_record/schema_migration.rb, line 47
    def normalized_versions
      pluck(:version).map { |v| normalize_migration_number v }
    end

primary_key() click to toggle source

    # File lib/active_record/schema_migration.rb, line 8
    def primary_key
      nil
    end

table_exists?() click to toggle source

    # File lib/active_record/schema_migration.rb, line 20
    def table_exists?
      connection.table_exists?(table_name)
    end

table_name() click to toggle source

    # File lib/active_record/schema_migration.rb, line 12
    def table_name
      "#{table_name_prefix}#{ActiveRecord::Base.schema_migrations_table_name}#{table_name_suffix}"
    end

### Public Instance Methods

version() click to toggle source
Calls superclass method

    # File lib/active_record/schema_migration.rb, line 52
    def version
      super.to_i
    end