mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
Gem mysql2 + port for test environment
This commit is contained in:
parent
3d33881897
commit
e5c2cac42a
3 changed files with 3 additions and 3 deletions
|
@ -128,8 +128,7 @@ class Agent < ActiveRecord::Base
|
|||
if keep_events_for == 0
|
||||
events.update_all :expires_at => nil
|
||||
else
|
||||
#events.update_all "expires_at = DATE_ADD(`created_at`, INTERVAL #{keep_events_for.to_i} DAY)"
|
||||
events.update_all "expires_at = " + rdbms_date_add("created_at","DAY",keep_events_for.to_i)
|
||||
events.update_all "expires_at = " + rdbms_date_add("created_at", "DAY", keep_events_for.to_i)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ test:
|
|||
socket: <%= ENV['DATABASE_SOCKET'] || ["/var/run/mysqld/mysqld.sock", "/opt/local/var/run/mysql5/mysqld.sock", "/tmp/mysql.sock"].find{ |path| File.exist? path } %>
|
||||
encoding: <%= ENV['DATABASE_ENCODING'] || "utf8" %>
|
||||
reconnect: <%= ENV['DATABASE_RECONNECT'] || "true" %>
|
||||
port: <%= ENV['DATABASE_PORT'] || "" %>
|
||||
pool: <%= ENV['DATABASE_POOL'] || "5" %>
|
||||
|
||||
production:
|
||||
|
|
|
@ -2,7 +2,7 @@ module RDBMSFunctions
|
|||
def rdbms_date_add(source, unit, amount)
|
||||
adapter_type = connection.adapter_name.downcase.to_sym
|
||||
case adapter_type
|
||||
when :mysql
|
||||
when :mysql, :mysql2
|
||||
"DATE_ADD(`#{source}`, INTERVAL #{amount} #{unit})"
|
||||
when :postgresql
|
||||
"(#{source} + INTERVAL '#{amount} #{unit}')"
|
||||
|
|
Loading…
Add table
Reference in a new issue