Class: Scheman::Views::Mysql::Index
- Inherits:
-
Node
- Object
- Node
- Scheman::Views::Mysql::Index
show all
- Defined in:
- lib/scheman/views/mysql.rb
Instance Method Summary
collapse
Methods inherited from Node
#initialize
Instance Method Details
#column ⇒ Object
332
333
334
|
# File 'lib/scheman/views/mysql.rb', line 332
def column
@element[:column]
end
|
#fulltext? ⇒ Boolean
322
323
324
|
# File 'lib/scheman/views/mysql.rb', line 322
def fulltext?
@element[:type] == "fulltext"
end
|
#prefix ⇒ Object
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
318
319
320
|
# File 'lib/scheman/views/mysql.rb', line 318
def primary_key?
!!@element[:primary]
end
|
#spatial? ⇒ Boolean
326
327
328
|
# File 'lib/scheman/views/mysql.rb', line 326
def spatial?
@element[:type] == "spatial"
end
|
#to_s ⇒ Object
314
315
316
|
# File 'lib/scheman/views/mysql.rb', line 314
def to_s
"#{prefix} (`#{column}`)"
end
|