Module: Swift::Migrations::InstanceMethods
- Included in:
- Adapter::Sql
- Defined in:
- lib/swift/migrations.rb
Overview
ClassMethods
Instance Method Summary collapse
Instance Method Details
#migrate!(record) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/swift/migrations.rb', line 36 def migrate! record keys = record.header.keys fields = record.header.map{|p| field_definition(p)}.join(', ') fields += ", primary key (#{keys.join(', ')})" unless keys.empty? execute("drop table if exists #{record.store} cascade") execute("create table #{record.store} (#{fields})") end |