Uni Ecto Plugin May 2026
def call(conn, _opts) do # Extract subdomain or API key tenant = get_tenant_from_subdomain(conn)
defmodule MyApp.Plugs.TenantResolver do import Plug.Conn import UniEcto.Plugin, only: [set_tenant_prefix: 1] def init(default), do: default uni ecto plugin
mix uni_ecto.gen.migration create_tenants_table This creates a migration that tracks tenants in a central tenants meta-table. Add the Plug to your router: def call(conn, _opts) do # Extract subdomain or
if Mix.env() == :prod do UniEcto.Plugin.set_tenant_prefix("public") end If you are searching for "uni ecto plugin," you might actually be looking for a specific adapter. Here is the landscape: only: [set_tenant_prefix: 1] def init(default)