Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,20 @@ Configure the Repo you will use to execute the database commands with:
### Additional configuration for MySQL

In MySQL, each tenant will have its own MySQL database.
Triplex uses a table called `tenants` in the main Repo to keep track of the different tenants.
Generate the migration that will create the table by running:
Triplex used to use a table called `tenants` in the main Repo to keep track of the different tenants.
If you wish to keep this behavior, generate the migration that will create the table by running:

mix triplex.mysql.install

And then create the table:

mix ecto.migrate

Otherwise, if you wish to skip this behavior, configure Triplex to use the default `information_schema.schemata` table:
Finally, configure Triplex to use the `tenants` table:

config :triplex, tenant_table: :"information_schema.schemata"
config :triplex, tenant_table: :tenants

Otherwise, Triplex will continue to use the `information_schema.schemata` table as the default behavior for storing tenants.

## Usage

Expand Down
2 changes: 2 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ config :triplex,
~r/^db\d+$/
]

config :triplex, tenant_table: :tenants

# Configure your database
config :triplex, ecto_repos: [Triplex.PGTestRepo, Triplex.MSTestRepo]

Expand Down
2 changes: 1 addition & 1 deletion lib/triplex/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ defmodule Triplex.Config do
migrations_path: "tenant_migrations",
reserved_tenants: [],
tenant_field: :id,
tenant_table: :tenants
tenant_table: :"information_schema.schemata"
]
end