Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncation in Sequel + PostgreSQL doesn't restart sequences #8

Open
alexgenco opened this issue Jul 29, 2013 · 1 comment
Open

Truncation in Sequel + PostgreSQL doesn't restart sequences #8

alexgenco opened this issue Jul 29, 2013 · 1 comment

Comments

@alexgenco
Copy link

All the tables are properly truncated, but consecutive test runs start auto-incremented sequences where they left off, instead of back at 1.

In lib/database_cleaner/sequel/truncation.rb, changing line 19:

db.run "TRUNCATE TABLE #{all_tables};"

to

db.run "TRUNCATE TABLE #{all_tables} RESTART IDENTITY;"

resolves the issue, but I suppose that could raise some compatibility issues with certain versions of PostgreSQL.

This seems like it would be a fairly simple PR, but I would rather get some insight from the maintainers first as I'm not at all familiar with this codebase. Thanks!

@zedtux
Copy link

zedtux commented Jan 26, 2018

@alexgenco what about having a configuration key to enabled/disable this behaviour?

@botandrose botandrose transferred this issue from DatabaseCleaner/database_cleaner Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants