-- Accounts signed in through an identity provider (OIDC): the provider's -- issuer and subject name the person; the account is ours. CREATE TABLE identities ( issuer text NOT NULL, subject text NOT NULL, account_id uuid NOT NULL REFERENCES accounts (id) ON DELETE CASCADE, email text, created_at timestamptz NOT NULL DEFAULT now(), last_seen_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (issuer, subject) ); CREATE INDEX identities_account ON identities (account_id);