mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:57:36 +08:00
BUGFIX: avoid trasactions in test
This commit is contained in:
parent
cce5fb3303
commit
0a0ed44248
|
@ -188,7 +188,7 @@ module Jobs
|
|||
parameter_markers = fields.map {|x| "?"}.join(',')
|
||||
sql_stmt = "INSERT INTO #{table_name} (#{fields.join(',')}) VALUES (#{parameter_markers})"
|
||||
|
||||
User.exec_sql("BEGIN TRANSACTION")
|
||||
User.exec_sql("BEGIN TRANSACTION") unless Rails.env.test?
|
||||
i = 0
|
||||
rows.each do |row|
|
||||
if i % batch_size == 0 && i > 0
|
||||
|
@ -197,7 +197,7 @@ module Jobs
|
|||
User.exec_sql(sql_stmt, *row)
|
||||
i += 1
|
||||
end
|
||||
User.exec_sql("COMMIT")
|
||||
User.exec_sql("COMMIT") unless Rails.env.test?
|
||||
|
||||
true
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user