(c *gin.Context)
| 516 | // Pre-check the per-org schema uniqueness for a clean error; the |
| 517 | // unique (org_id, schema_name) index still backs it — a concurrent |
| 518 | // writer that slips past the check fails with a 23505 (same |
| 519 | // contract as configstore.UpsertOrgTeamTx). |
| 520 | var clash int64 |
| 521 | if err := tx.Model(&configstore.OrgTeam{}). |
| 522 | Where("org_id = ? AND schema_name = ? AND team_id <> ?", orgID, *upd.SchemaName, teamID). |
| 523 | Count(&clash).Error; err != nil { |
| 524 | return err |
| 525 | } |
| 526 | if clash > 0 { |
| 527 | return configstore.ErrOrgTeamSchemaConflict |
| 528 | } |
| 529 | fields["schema_name"] = *upd.SchemaName |
| 530 | } |
| 531 | if upd.Enabled != nil { |
| 532 | fields["enabled"] = *upd.Enabled |
| 533 | } |
| 534 | if upd.Backfill != nil { |
| 535 | fields["backfill_enabled"] = *upd.Backfill |
| 536 | } |
| 537 | if upd.EventsTableNameSet { |
| 538 | fields["events_table_name"] = upd.EventsTableName |
| 539 | } |
| 540 | if upd.PersonsTableNameSet { |
| 541 | fields["persons_table_name"] = upd.PersonsTableName |
| 542 | } |
| 543 | if upd.SchemaDataImportsNameSet { |
| 544 | fields["schema_data_imports_name"] = upd.SchemaDataImportsName |
| 545 | } |
| 546 | if upd.EarliestEventDateSet { |
| 547 | fields["earliest_event_date"] = upd.EarliestEventDate |
| 548 | } |
| 549 | if len(fields) > 1 { |
| 550 | if err := tx.Model(&configstore.OrgTeam{}). |
nothing calls this directly
no test coverage detected