aaronrenner / phx_gen_auth

An authentication system generator for Phoenix 1.5 applications.
772 stars 55 forks source link

Generator option for multitenancy via query prefixes #33

Closed soullpoint closed 4 years ago

soullpoint commented 4 years ago

Hi, this is just something to consider. I'm not sure if this is something you think would belong in the generator.

I am currently looking at creating a multi-tenant system using the query prefix as the mechanism for separating the Tenants (https://hexdocs.pm/ecto/multi-tenancy-with-query-prefixes.html and https://github.com/ateliware/triplex). I'm interested in using this generator as the basis for the authentication system, but I found that I would have to make pretty extensive changes to support the "prefix" queries - all the existing queries, tests, etc would need to be modified I think.

Given that this is a generator, I was thinking that it might be possible to have this as a configurable option - i.e. the queries and such would be generated with the prefixes.

For my project I'll likely be going through the changes manually, but this might be useful for future projects / others.

Thanks!

josevalim commented 4 years ago

The generators are meant to be a starting point, so we generally don't plan on adding more complexity to it. Adding flags in particular can be very hard, because once we have 4 different flags, it can be hard for us to guarantee that generated output is it still safe for all possible combinations of the 4 flags. So our plan is to keep it simple. :+1: