lib/og/store/mysql.rb in og-0.22.0 vs lib/og/store/mysql.rb in og-0.23.0

- old
+ new

@@ -10,10 +10,24 @@ rescue Object => ex Logger.error ex end end +# Helper for scripts. +# +# === Example +# +# mysql "-u root -p", <<-END +# drop database if exists weblog_development; +# create database weblog_development; +# grant all on weblog_development.* to #{`id -un`.strip}@localhost; +# END + +def mysql(opts, stream) + IO.popen("mysql #{opts}", 'w') { |io| io.puts stream } +end + require 'og/store/sql' # Customize the standard mysql resultset to make # more compatible with Og. @@ -230,10 +244,11 @@ for info in join_tables begin create_join_table_sql(info).each do |sql| @conn.query sql end + Logger.debug "Created jointable '#{info[:table]}'." rescue => ex if ex.respond_to?(:errno) and ex.errno == 1050 # table already exists. Logger.debug 'Join table already exists' if $DBG else raise @@ -318,5 +333,7 @@ end end end + +# * George Moschovitis <gm@navel.gr>