Method: MotionRecord::Schema::TableDefinition#execute

Defined in:
lib/motion_record/schema/table_definition.rb

#executeObject



14
15
16
17
18
19
20
21
# File 'lib/motion_record/schema/table_definition.rb', line 14

def execute
  # Create table
  column_sql = @columns.map(&:to_sql_definition).join(", ")
  MotionRecord::Base.connection.execute "CREATE TABLE #{@name} (#{column_sql})"

  # Create table's indexes
  @index_definitions.each(&:execute)
end