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
341
342
343
|
# File 'lib/scheman/views/mysql.rb', line 341
def column
@element[:column]
end
|
#fulltext? ⇒ Boolean
331
332
333
|
# File 'lib/scheman/views/mysql.rb', line 331
def fulltext?
@element[:type] == "fulltext"
end
|
#prefix ⇒ Object
347
348
349
350
351
352
353
354
355
356
357
358
|
# File 'lib/scheman/views/mysql.rb', line 347
def prefix
case
when primary_key?
"PRIMARY KEY"
when fulltext?
"FULLTEXT"
when spatial?
"SPATIAL"
else
"KEY"
end
end
|
#primary_key? ⇒ Boolean
327
328
329
|
# File 'lib/scheman/views/mysql.rb', line 327
def primary_key?
!!@element[:primary]
end
|
#spatial? ⇒ Boolean
335
336
337
|
# File 'lib/scheman/views/mysql.rb', line 335
def spatial?
@element[:type] == "spatial"
end
|
#to_s ⇒ Object
323
324
325
|
# File 'lib/scheman/views/mysql.rb', line 323
def to_s
"#{prefix} (`#{column}`)"
end
|