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

Duplicated records issue #138

Open
pierreferry opened this issue Oct 10, 2018 · 1 comment
Open

Duplicated records issue #138

pierreferry opened this issue Oct 10, 2018 · 1 comment

Comments

@pierreferry
Copy link

pierreferry commented Oct 10, 2018

I encountered an issue with one table of my database : duplicates.
For example if the table was 100 entities, i had 100 entities to import but with duplicates, meaning there were some entities lost in the process.
After investigation i realised those entities were duplicated because of the order method wasn't working, breaking in the same time the batching algorithm.

That's why i forked the project and replaced line 8 in enumeration.rb :
records.order("#{records.quoted_table_name}.#{records.quoted_primary_key} ASC")
by
records = records.order(records.primary_key => :asc)

I hope this helps someone

@supaspoida
Copy link

This helped me, thank you @pierreferry!

It's also possible to bypass this bug by specifying an order yourself, like so: SeedDump.dump(SomeThing.order(id: :asc)).

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