View Source EctoGraf

Build Status Version Hex Docs Download License Last Updated

Take advantage of Ecto associations to deep clone data in your database.

To clone a post with it's comments and tags:

{:ok, cloned_post_id} = EctoGraf.clone(%Post{id: 5}, Repo, %{title: "new title"}, [Comment, PostTag])

See clone docs for more information and examples.

Todo

  • [ ] error when intermediate schemas are missing
  • [ ] support mysql
  • [ ] support sqlite
  • [ ] clone tables in parallel
  • [ ] fix self references in parallel
  • [ ] support foreign key != :id
  • [ ] error when circular associations