lib/baza/driver/mysql/database.rb in baza-0.0.27 vs lib/baza/driver/mysql/database.rb in baza-0.0.28

- old
+ new

@@ -39,12 +39,25 @@ ) end sql << ")" - return [sql] if args && args[:return_sql] + # return [sql] if args && args[:return_sql] - use { @db.query(sql) } + sql = Baza::Driver::Mysql::Sql::CreateTable.new( + columns: data.fetch(:columns), + indexes: data[:indexes], + name: name, + temporary: data[:temp] + ).sql + + return sql if args && args[:return_sql] + + use do + sql.each do |sql_i| + @db.query(sql_i) + end + end end def rename(new_name) new_name = new_name.to_s @db.databases.create(name: new_name)