--- Orgs ---
(c *gin.Context)
| 507 | return err |
| 508 | } |
| 509 | prev = team |
| 510 | |
| 511 | fields := map[string]interface{}{"updated_at": gorm.Expr("now()")} |
| 512 | if upd.SchemaName != nil && *upd.SchemaName != team.SchemaName { |
| 513 | // Pre-check the per-org schema uniqueness for a clean error; the |
| 514 | // unique (org_id, schema_name) index still backs it — a concurrent |
| 515 | // writer that slips past the check fails with a 23505 (same |
| 516 | // contract as configstore.UpsertOrgTeamTx). |
| 517 | var clash int64 |
| 518 | if err := tx.Model(&configstore.OrgTeam{}). |
| 519 | Where("org_id = ? AND schema_name = ? AND team_id <> ?", orgID, *upd.SchemaName, teamID). |