Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

Stop disabled tenants from resetting to readonly

Matt Robertsbb98ac420466
diff --git a/app/services/sqlstore/postgres/billing.go b/app/services/sqlstore/postgres/billing.go
index 4b830e612..891de2b49 100644
--- a/app/services/sqlstore/postgres/billing.go
+++ b/app/services/sqlstore/postgres/billing.go
@@ -115,11 +115,11 @@ func lockExpiredTenants(ctx context.Context, c *cmd.LockExpiredTenants) error {
FROM tenants t
INNER JOIN tenants_billing tb
ON t.id = tb.tenant_id
- WHERE t.status <> $1
+ WHERE t.status <> $1 AND t.status <> $2
AND (
- (tb.status = $2 AND trial_ends_at <= $4)
- OR (tb.status = $3 AND subscription_ends_at <= $4)
- )`, enum.TenantLocked, enum.BillingTrial, enum.BillingCancelled, now)
+ (tb.status = $3 AND trial_ends_at <= $5)
+ OR (tb.status = $4 AND subscription_ends_at <= $5)
+ )`, enum.TenantLocked, enum.TenantDisabled, enum.BillingTrial, enum.BillingCancelled, now)
if err != nil {
return errors.Wrap(err, "failed to get expired trial/cancelled tenants")
}