mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
Merge pull request #84 from jhollinger/master
Truncation should reset a table's id column
This commit is contained in:
commit
0e42715d1f
2 changed files with 4 additions and 1 deletions
|
@ -54,6 +54,7 @@ module ActiveRecord
|
|||
class SQLite3Adapter < SQLITE_ADAPTER_PARENT
|
||||
def delete_table(table_name)
|
||||
execute("DELETE FROM #{quote_table_name(table_name)};")
|
||||
execute("DELETE FROM sqlite_sequence where name = '#{table_name}';")
|
||||
end
|
||||
alias truncate_table delete_table
|
||||
end
|
||||
|
|
|
@ -53,6 +53,7 @@ module DataMapper
|
|||
|
||||
def truncate_table(table_name)
|
||||
execute("DELETE FROM #{quote_name(table_name)};")
|
||||
execute("DELETE FROM sqlite_sequence where name = '#{table_name}';")
|
||||
end
|
||||
|
||||
# this is a no-op copied from activerecord
|
||||
|
@ -79,6 +80,7 @@ module DataMapper
|
|||
|
||||
def truncate_table(table_name)
|
||||
execute("DELETE FROM #{quote_name(table_name)};")
|
||||
execute("DELETE FROM sqlite_sequence where name = '#{table_name}';")
|
||||
end
|
||||
|
||||
# this is a no-op copied from activerecord
|
||||
|
@ -107,7 +109,7 @@ module DataMapper
|
|||
end
|
||||
|
||||
def truncate_table(table_name)
|
||||
execute("TRUNCATE TABLE #{quote_name(table_name)} CASCADE;")
|
||||
execute("TRUNCATE TABLE #{quote_name(table_name)} RESTART IDENTITY CASCADE;")
|
||||
end
|
||||
|
||||
# FIXME
|
||||
|
|
Loading…
Reference in a new issue