class SchemaRD::MigrationContext::Loader

Public Class Methods

new(schema, with_comment: false) click to toggle source

“with_comment” must be assigned, but ruby2.0 needs default value.

# File lib/schemard/schema_parser.rb, line 53
def initialize(schema, with_comment: false)
  @schema = schema
  @parse_db_comment = with_comment
end

Public Instance Methods

add_index(table_name, column_name, options = {}) click to toggle source
# File lib/schemard/schema_parser.rb, line 65
def add_index(table_name, column_name, options = {})
  column_name = [ column_name ] unless column_name.is_a?(Array)
  index = SchemaRD::TableIndex.new(options.merge({ columns: column_name }))
  @schema.table(table_name).indexes << index
end
create_table(table_name, options = {}) { |table_definition(table, with_comment: parse_db_comment)| ... } click to toggle source
# File lib/schemard/schema_parser.rb, line 57
def create_table(table_name, options = {})
  if options[:comment] && @parse_db_comment
    options[:parsed_db_comment] = options.delete(:comment)
  end
  table = SchemaRD::Table.new(options.merge(name: table_name))
  @schema.add_table(table_name, table)
  yield TableDefinition.new(table, with_comment: @parse_db_comment)
end
enable_extension(*args) click to toggle source
# File lib/schemard/schema_parser.rb, line 70
def enable_extension(*args); end