diff --git a/internal/store/postgres/person_repository.go b/internal/store/postgres/person_repository.go index 9d76f6ea..83d4485a 100644 --- a/internal/store/postgres/person_repository.go +++ b/internal/store/postgres/person_repository.go @@ -119,7 +119,7 @@ func (personRepository PersonRepository) canonicalizePersonReferences(legacyPers return errorValue } } - return personRepository.canonicalizePersonCircles(legacyPersonID, personID) + return nil } func canonicalPersonReferenceUpdateStatements() []canonicalPersonReferenceUpdate { @@ -145,20 +145,3 @@ func (personRepository PersonRepository) hasTable(tableName string) (bool, error errorValue := row.Scan(&hasTable) return hasTable, errorValue } - -func (personRepository PersonRepository) canonicalizePersonCircles(legacyPersonID string, personID string) error { - _, errorValue := personRepository.database.SQL.ExecContext(context.Background(), ` -INSERT INTO person_circle (person_circle_id, person_id, circle_id, source, created_at, updated_at) -SELECT $2 || ':' || circle_id, $2, circle_id, source, created_at, updated_at -FROM person_circle -WHERE person_id = $1 -ON CONFLICT (person_id, circle_id) DO UPDATE SET - source = EXCLUDED.source, - updated_at = EXCLUDED.updated_at`, legacyPersonID, personID) - if errorValue != nil { - return errorValue - } - _, errorValue = personRepository.database.SQL.ExecContext(context.Background(), ` -DELETE FROM person_circle WHERE person_id = $1`, legacyPersonID) - return errorValue -} diff --git a/migrations/030_drop_the_circle_tables_nobody_reads.sql b/migrations/030_drop_the_circle_tables_nobody_reads.sql new file mode 100644 index 00000000..258ddedf --- /dev/null +++ b/migrations/030_drop_the_circle_tables_nobody_reads.sql @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS mattermost_circle_link; +DROP TABLE IF EXISTS person_circle; +DROP TABLE IF EXISTS circle; +DROP TABLE IF EXISTS resource_access_rule; diff --git a/tests/integration/migrations_apply_test.go b/tests/integration/migrations_apply_test.go index 3b6cdd2c..8ec6f5a2 100644 --- a/tests/integration/migrations_apply_test.go +++ b/tests/integration/migrations_apply_test.go @@ -15,8 +15,8 @@ func TestMigrationsApplyList(t *testing.T) { if errorValue != nil { t.Fatalf("expected migrations to load: %v", errorValue) } - if len(migrationPaths) != 29 { - t.Fatalf("expected 29 migration files, got %d", len(migrationPaths)) + if len(migrationPaths) != 30 { + t.Fatalf("expected 30 migration files, got %d", len(migrationPaths)) } }