-
Notifications
You must be signed in to change notification settings - Fork 11
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
Sequel+postgresql truncate strategy fails if there's tables in other schemas #9
Comments
I'm having issues to truncate tables in different schemas but the same DBs as well, is this even supported? cc @joevandyk @bmabey |
same question. |
Ok nevermind, it worked for me in rspec like this:
I also included a test code in the source:
Testing:
|
we’re running all specs in a transaction now, which works just fine. around do |example|
connection = Sequel.connect(config)
connection.transaction do
example.run
# force rollback
raise Sequel::Error::Rollback
end
end |
nice 👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I have a table in the "audit" schema on postgresql, using the Sequel truncate strategy will fail. A quick review of the code shows something like this is happening:
execute "truncate #{ db.tables.join(', ')"
db.tables
will return a list of all the tables without being schema-qualified. So if I have public.orders and audit.logged_actions, this gets ran:truncate orders, logged_actions
which will fail.A possible solution is to get this SQL running instead:
truncate public.orders, audit.logged_actions
The text was updated successfully, but these errors were encountered: