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

Backfill data page - question on "next_page = results |> Enum.reverse() |> List.first()" #13

Open
lovebes opened this issue Oct 18, 2023 · 5 comments

Comments

@lovebes
Copy link

lovebes commented Oct 18, 2023

Hi, in https://fly.io/phoenix-files/backfilling-data/#batching-deterministic-data - The code in getting the next_page id, this seems to imply that Repo.update_all would return the results in an ordered list, and in reversed order.

Would that be true? I wonder if you'd need to do some sorting on the result to get the tail of the result?

@dbernheisel
Copy link
Collaborator

That's a good catch! I suspect adding an order during update could make it deterministic, otherwise sorting application-side is fine too.

@lovebes
Copy link
Author

lovebes commented Oct 19, 2023

Ah thanks for confirming! Would it be possible to edit the example in the article? The migration series of articles is imho a very important document that I refer to time and time again at work. Really appreciate the work put into the article!!

@dbernheisel
Copy link
Collaborator

Will do!

@dbernheisel
Copy link
Collaborator

dbernheisel commented Nov 14, 2023

I haven't forgotten about this. FWIW, I think adding a CTE to ensure order is the right solution (or sorting Elixir-side), just need to write the example and test it.

@lovebes
Copy link
Author

lovebes commented Nov 21, 2023

@dbernheisel no worries thank you!
Really appreciate ThinkingElixir podcast and thanks for all the time and effort to bring quality news about Elixir to the listeners! 👍

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