Class: Scheman::Views::Mysql::Index

Inherits:
Node
  • Object
show all
Defined in:
lib/scheman/views/mysql.rb

Instance Method Summary collapse

Methods inherited from Node

#initialize

Constructor Details

This class inherits a constructor from Scheman::Views::Mysql::Node

Instance Method Details

#columnObject

Examples:

"id"


332
333
334
# File 'lib/scheman/views/mysql.rb', line 332

def column
  @element[:column]
end

#fulltext?Boolean

Returns:

  • (Boolean)


322
323
324
# File 'lib/scheman/views/mysql.rb', line 322

def fulltext?
  @element[:type] == "fulltext"
end

#prefixObject

Examples:

"PRIMARY KEY"


338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/scheman/views/mysql.rb', line 338

def prefix
  case
  when primary_key?
    "PRIMARY KEY"
  when fulltext?
    "FULLTEXT"
  when spatial?
    "SPATIAL"
  else
    "KEY"
  end
end

#primary_key?Boolean

Returns:

  • (Boolean)


318
319
320
# File 'lib/scheman/views/mysql.rb', line 318

def primary_key?
  !!@element[:primary]
end

#spatial?Boolean

Returns:

  • (Boolean)


326
327
328
# File 'lib/scheman/views/mysql.rb', line 326

def spatial?
  @element[:type] == "spatial"
end

#to_sObject



314
315
316
# File 'lib/scheman/views/mysql.rb', line 314

def to_s
  "#{prefix} (`#{column}`)"
end