Open Metallion opened 9 years ago
I think that what the paranoid plugin solved is different.
The reason why we set primary key ID to is_deleted
Integer column is to avoid error from destroying of multiple rows. Assume that the destroy operation for two rows happen within 1 second, they will get same time value in deleted_at
DateTime column and causes the unique constraint error.
This issue is database product dependent since MySQL's DataTime stores second as smallest unit but Postgres one takes much smaller time unit for equivalent column type.
Why is there a unique constraint on the is_deleted column ?
because those tables are logical deleted.
Problem
In the past we have patched the
sequel/paranoia
plugin to allow for unique constraints. Our patch is in this file over here.Looking at the plugin today, it seems like they have solved the unique constraints issue themselves.
Solution
Refactor our code to get rid of the monkey patch and use paranoia as is again. This should not be worked on until the
bundle update
pull request is done in https://github.com/axsh/openvnet/pull/307.