mirror of
https://github.com/btouchard/ackify-ce.git
synced 2026-02-08 06:48:32 -06:00
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
This commit is contained in:
@@ -121,19 +121,20 @@ func (tdb *TestDB) createSchema() error {
|
||||
return fmt.Errorf("failed to get working directory: %w", err)
|
||||
}
|
||||
|
||||
// Walk up the directory tree looking for backend/migrations
|
||||
// Walk up the directory tree looking for migrations directory
|
||||
found := false
|
||||
searchDir := wd
|
||||
for i := 0; i < 10; i++ {
|
||||
testPath := filepath.Join(searchDir, "backend", "migrations")
|
||||
// Try migrations in current directory
|
||||
testPath := filepath.Join(searchDir, "migrations")
|
||||
if stat, err := os.Stat(testPath); err == nil && stat.IsDir() {
|
||||
migrationsPath = testPath
|
||||
found = true
|
||||
break
|
||||
}
|
||||
|
||||
// Also try just "migrations" directory
|
||||
testPath = filepath.Join(searchDir, "migrations")
|
||||
// Try backend/migrations (for root project directory)
|
||||
testPath = filepath.Join(searchDir, "backend", "migrations")
|
||||
if stat, err := os.Stat(testPath); err == nil && stat.IsDir() {
|
||||
migrationsPath = testPath
|
||||
found = true
|
||||
|
||||
Reference in New Issue
Block a user