Skip to content

Commit 8ca23ce

Browse files
committed
fix: ensure migrations directory is found in CI tests
- Fix migration path lookup to check both './migrations' and './backend/migrations' - Remove hardcoded test schema in admin handler tests - Use database.SetupTestDB which applies all migrations automatically - Ensures test schema matches production schema with all columns (deleted_at, doc_checksum, etc.) - Fixes test failures in CI where admin handler tests returned empty responses
1 parent 2410653 commit 8ca23ce

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

backend/internal/infrastructure/database/testutils.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,19 +121,20 @@ func (tdb *TestDB) createSchema() error {
121121
return fmt.Errorf("failed to get working directory: %w", err)
122122
}
123123

124-
// Walk up the directory tree looking for backend/migrations
124+
// Walk up the directory tree looking for migrations directory
125125
found := false
126126
searchDir := wd
127127
for i := 0; i < 10; i++ {
128-
testPath := filepath.Join(searchDir, "backend", "migrations")
128+
// Try migrations in current directory
129+
testPath := filepath.Join(searchDir, "migrations")
129130
if stat, err := os.Stat(testPath); err == nil && stat.IsDir() {
130131
migrationsPath = testPath
131132
found = true
132133
break
133134
}
134135

135-
// Also try just "migrations" directory
136-
testPath = filepath.Join(searchDir, "migrations")
136+
// Try backend/migrations (for root project directory)
137+
testPath = filepath.Join(searchDir, "backend", "migrations")
137138
if stat, err := os.Stat(testPath); err == nil && stat.IsDir() {
138139
migrationsPath = testPath
139140
found = true

0 commit comments

Comments
 (0)