Method: Wukong::Schema::ClassMethods#to_sql
- Defined in:
- lib/wukong/schema.rb
#to_sql ⇒ Object
Schema definition for use in a CREATE TABLE statement
153 154 155 156 157 158 159 160 |
# File 'lib/wukong/schema.rb', line 153 def to_sql sql_str = [] members.zip(mtypes).each do |attr, type| type_str = type.respond_to?(:to_sql) ? type.to_sql : type.to_s.upcase sql_str << " %-29s\t%s" %["`#{attr}`", type_str] end sql_str.join(",\n") end |