Class: Swift::Adapter::Mysql
- Inherits:
-
Sql
- Object
- Swift::Adapter
- Sql
- Swift::Adapter::Mysql
- Defined in:
- lib/swift/adapter/mysql.rb
Instance Attribute Summary
Attributes inherited from Swift::Adapter
Instance Method Summary collapse
-
#field_type(attribute) ⇒ Object
TODO Swift::Type::Bignum ? serial is an alias for bigint in mysql, we want integer type to be migrated as integer type in the database (not bigint or smallint or shortint or whatever).
-
#initialize(options = {}) ⇒ Mysql
constructor
A new instance of Mysql.
- #returning? ⇒ Boolean
- #tables ⇒ Object
Methods inherited from Sql
#fields, #serialized_transaction, #transaction
Methods included from Migrations::InstanceMethods
Methods inherited from Swift::Adapter
#aexecute, #blocking_execute, #create, #delete, #execute, #get, #identity_map, #log_command, #pending, #prepare, #trace, #trace?, #update
Constructor Details
Instance Method Details
#field_type(attribute) ⇒ Object
TODO Swift::Type::Bignum ? serial is an alias for bigint in mysql, we want integer type to be migrated as integer type in the database (not bigint or smallint or shortint or whatever).
18 19 20 21 22 23 |
# File 'lib/swift/adapter/mysql.rb', line 18 def field_type attribute case attribute when Type::Integer then attribute.serial ? 'integer auto_increment' : 'integer' else super end end |
#returning? ⇒ Boolean
11 12 13 |
# File 'lib/swift/adapter/mysql.rb', line 11 def returning? false end |
#tables ⇒ Object
25 26 27 |
# File 'lib/swift/adapter/mysql.rb', line 25 def tables execute("show tables").map(&:values).flatten end |