Created
January 2, 2018 21:41
-
-
Save weixiyen/63428b18085141dc15527f49946dccf5 to your computer and use it in GitHub Desktop.
Revisions
-
weixiyen created this gist
Jan 2, 2018 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ User |> prepared(user_id: user_id, username: username) |> insert(user_id: :user_id, username: :username) |> if_not_exists |> User.save User |> update(username: username) |> where(user_id: user_id) |> constrain(username: previous_username) |> User.save User |> prepared(user_id: user_id) |> delete(:all) # here :all refers to all fields |> where(user_id: :user_id) |> User.del