class Scheman::Views::Mysql::AddIndex

Public Instance Methods

to_s() click to toggle source
# File lib/scheman/views/mysql.rb, line 179
def to_s
  "ADD #{index_definition_name} #{index}"
end

Private Instance Methods

index() click to toggle source
# File lib/scheman/views/mysql.rb, line 208
def index
  str = ""
  str << "#{index_name} " if index_name
  str << "#{index_type} " if index_type
  str << "`#{index_column}`"
end
index_column() click to toggle source
# File lib/scheman/views/mysql.rb, line 204
def index_column
  @element[:column]
end
index_definition_name() click to toggle source
# File lib/scheman/views/mysql.rb, line 189
def index_definition_name
  case
  when @element[:primary]
    "PRIMARY KEY"
  when @element[:unique]
    "UNIQUE KEY"
  else
    "KEY"
  end
end
index_name() click to toggle source
# File lib/scheman/views/mysql.rb, line 185
def index_name
  @element[:name]
end
index_type() click to toggle source
# File lib/scheman/views/mysql.rb, line 200
def index_type
  @element[:type]
end