This feature introduces multi tenancy with foreign keys. This is a very common setup that mimics what you can see for example in Github with different organisations.

It assumes that you have a users table and generates an accounts table and an account_memberships table.

The basic idea is that:

  1. All users gets an private account.
  2. There is an interface for creating a team and inviting other users to that team.
  3. You can create other resources (like projects) that belongs to the account.
  4. Ecto enforces you to pass in an account_id if there is such a column in the database, to prevent data leaks.