The hourly clean up deletes an invited account whose invitation expired. The row that placed that account in a tenant stays, because the membership table has no foreign key to the accounts table. The tenant's member count is then one too high, and the stale row is never removed.
The membership should go when the account goes, either through a foreign key that cascades or through a sweep in the clean up.
The hourly clean up deletes an invited account whose invitation expired. The row that placed that account in a tenant stays, because the membership table has no foreign key to the accounts table. The tenant's member count is then one too high, and the stale row is never removed.
The membership should go when the account goes, either through a foreign key that cascades or through a sweep in the clean up.