Created
January 1, 2017 20:09
-
-
Save chrisortman/c0b039eb82203eb2cc94d9bb6cc1a908 to your computer and use it in GitHub Desktop.
How to bulk generate UUID values for a new column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for id <- Repo.all( from r in "recipients", select: r.id ), | |
{id, uid} = {id, Ecto.UUID.bingenerate}, | |
do: from(r in "recipients", where: r.id == ^id, update: [set: [uid: ^uid]]) | |
|> Repo.update_all([]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment