Skip to content

Commit 9859e3f

Browse files
eastriverleeclaude
andcommitted
chore: drop the circle tables nobody reads
Migration 014 created circle, person_circle, resource_access_rule and mattermost_circle_link. The circle table has never had an INSERT or a SELECT anywhere in this repository, and person_circle had one writer: a copy from itself onto a new person ID, which moved rows nothing put there. resource_access_rule and mattermost_circle_link are named only by the migration that made them. An empty table with a plausible name is worse than no table. Somebody looked at circle and circle_member today and asked for them to be filled, which would have changed nothing, because what actually decides a person's circles is policy.json and the person.circles column projected from it. Those stay, as does graphiti_namespace.scope_circle_id. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 4b1550d commit 9859e3f

3 files changed

Lines changed: 7 additions & 20 deletions

File tree

internal/store/postgres/person_repository.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (personRepository PersonRepository) canonicalizePersonReferences(legacyPers
119119
return errorValue
120120
}
121121
}
122-
return personRepository.canonicalizePersonCircles(legacyPersonID, personID)
122+
return nil
123123
}
124124

125125
func canonicalPersonReferenceUpdateStatements() []canonicalPersonReferenceUpdate {
@@ -145,20 +145,3 @@ func (personRepository PersonRepository) hasTable(tableName string) (bool, error
145145
errorValue := row.Scan(&hasTable)
146146
return hasTable, errorValue
147147
}
148-
149-
func (personRepository PersonRepository) canonicalizePersonCircles(legacyPersonID string, personID string) error {
150-
_, errorValue := personRepository.database.SQL.ExecContext(context.Background(), `
151-
INSERT INTO person_circle (person_circle_id, person_id, circle_id, source, created_at, updated_at)
152-
SELECT $2 || ':' || circle_id, $2, circle_id, source, created_at, updated_at
153-
FROM person_circle
154-
WHERE person_id = $1
155-
ON CONFLICT (person_id, circle_id) DO UPDATE SET
156-
source = EXCLUDED.source,
157-
updated_at = EXCLUDED.updated_at`, legacyPersonID, personID)
158-
if errorValue != nil {
159-
return errorValue
160-
}
161-
_, errorValue = personRepository.database.SQL.ExecContext(context.Background(), `
162-
DELETE FROM person_circle WHERE person_id = $1`, legacyPersonID)
163-
return errorValue
164-
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
DROP TABLE IF EXISTS mattermost_circle_link;
2+
DROP TABLE IF EXISTS person_circle;
3+
DROP TABLE IF EXISTS circle;
4+
DROP TABLE IF EXISTS resource_access_rule;

tests/integration/migrations_apply_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ func TestMigrationsApplyList(t *testing.T) {
1515
if errorValue != nil {
1616
t.Fatalf("expected migrations to load: %v", errorValue)
1717
}
18-
if len(migrationPaths) != 29 {
19-
t.Fatalf("expected 29 migration files, got %d", len(migrationPaths))
18+
if len(migrationPaths) != 30 {
19+
t.Fatalf("expected 30 migration files, got %d", len(migrationPaths))
2020
}
2121
}
2222

0 commit comments

Comments
 (0)