bonfire-networks / bonfire-app

Bonfire - tend to your digital life in community. Customise and host your own online space and control your experience at the most granular level.
https://bonfirenetworks.org
GNU Affero General Public License v3.0
592 stars 44 forks source link

optimise `Users.create_missing_boundaries` so it runs quicker and doesn't output constraint errors #787

Open mayel opened 11 months ago

mayel commented 11 months ago

also it's bad practice to run seeds/fixtures as part of migrations so may need to run them some other way

chobeat commented 4 months ago

I will pick this one. I'm gonna start by writing some tests on the defaults and refactor a good part of Bonfire.Boundaries.Users because it's a bit messy, then move to the optimization.

Here there's not much detail, but I would assume the optimization is about these reinsert attempts, right? https://github.com/bonfire-networks/bonfire_boundaries/blob/main/lib/contexts/users.ex#L94

mayel commented 4 months ago

Great :) Yeah that's right. I'll note that the comment about "bad practice to run seeds/fixtures as part of migrations" is no longer relevant as I recently added EctoSparkles.DataMigration and refactored this to use it instead of Ecto schema migrations.

mayel commented 4 months ago

@chobeat I've started adding some docs to boundaries code which hopefully makes it more readable: https://github.com/bonfire-networks/bonfire_boundaries/commit/9256cc61b59e421c799aeb61ebcbd19c1acb7a87

chobeat commented 4 months ago

thanks, that will help me a lot