Class: Migr8::DBMS::MySQL
Defined Under Namespace
Classes: Skeleton
Constant Summary
collapse
- SYMBOL =
'mysql'
- PATTERN =
/\bmysql\b/
Instance Attribute Summary
Attributes inherited from Base
#command, #history_table, #sqltmpfile
Instance Method Summary
collapse
Methods inherited from Base
#apply_migrations, #create_history_table, detect_by_command, #fetch_column_value_of, inherited, #initialize, #new_skeleton, #unapply_migrations
Instance Method Details
#execute_sql(sql, cmdopt = nil) ⇒ Object
1126
1127
1128
1129
1130
|
# File 'lib/migr8.rb', line 1126
def execute_sql(sql, cmdopt=nil)
preamble = ""
sql = sql.gsub(/^-----/, '-- --')
return super(preamble+sql, cmdopt)
end
|
#get_migrations ⇒ Object
1175
1176
1177
1178
|
# File 'lib/migr8.rb', line 1175
def get_migrations()
migrations = _get_migrations("-s", /\t/)
return migrations
end
|
#history_table_exist? ⇒ Boolean
1169
1170
1171
1172
1173
|
# File 'lib/migr8.rb', line 1169
def history_table_exist?
table = history_table()
output = execute_sql("show tables like '#{table}';")
return output.include?(table)
end
|
#q(str) ⇒ Object
1165
1166
1167
|
# File 'lib/migr8.rb', line 1165
def q(str)
return str.gsub(/[\\']/, '\\\\\&')
end
|
#run_sql(sql, opts = {}) ⇒ Object
1132
1133
1134
1135
1136
|
# File 'lib/migr8.rb', line 1132
def run_sql(sql, opts={})
preamble = ""
sql = sql.gsub(/^-----/, '-- --')
return super(preamble+sql, opts)
end
|