mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
Bugfix to ActiveRecord PostgreSQLAdapter pre_count
This commit is contained in:
parent
d1e2dc973e
commit
fdc64dbbb2
1 changed files with 2 additions and 2 deletions
|
@ -139,8 +139,8 @@ module DatabaseCleaner
|
|||
# but then the table is cleaned. In other words, this function tells us if the given table
|
||||
# was ever inserted into.
|
||||
def has_been_used?(table)
|
||||
cur_val = select_value("SELECT currval('#{table}_id_seq');").to_i rescue ActiveRecord::StatementInvalid
|
||||
cur_val && cur_val > 0
|
||||
cur_val = select_value("SELECT currval('#{table}_id_seq');").to_i rescue 0
|
||||
cur_val > 0
|
||||
end
|
||||
|
||||
def has_rows?(table)
|
||||
|
|
Loading…
Reference in a new issue