38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/railstar/column_comment.rb', line 38
def create_table(table_name, options = {})
td = table_definition
td.primary_key(options[:primary_key] || Base.get_primary_key(table_name.to_s.singularize)) unless options[:id] == false
yield td if block_given?
drop_table(table_name) if options[:force] && table_exists?(table_name)
create_sql = "CREATE#{' TEMPORARY' if options[:temporary]} TABLE "
create_sql << "#{quote_table_name(table_name)} ("
create_sql << td.to_sql
create_sql << ") "
create_sql << " COMMENT='#{options[:comment]}'" if options[:comment]
create_sql << " #{options[:options]}"
execute create_sql
end
|