diff options
| author | Grail Finder <wohilas@gmail.com> | 2026-03-14 12:38:46 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2026-03-14 12:38:46 +0300 |
| commit | 77c365959d61142a96f26d820a9ad2665101c34f (patch) | |
| tree | 1ef28b73026ecf73858a049f6487f67f72f394e4 /storage/migrate.go | |
| parent | f4fcb8557005a5358b87109d945acd3d5a6a0517 (diff) | |
| parent | 4cfe2fe37f3b048bc7fad2e197dd0d49ea4307ce (diff) | |
Merge branch 'master' into feat/agent-flow
Diffstat (limited to 'storage/migrate.go')
| -rw-r--r-- | storage/migrate.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/storage/migrate.go b/storage/migrate.go index 38f9854..b6fed37 100644 --- a/storage/migrate.go +++ b/storage/migrate.go @@ -23,9 +23,20 @@ func (p *ProviderSQL) Migrate() error { p.logger.Error("Failed to read migrations directory;", "error", err) return fmt.Errorf("failed to read migrations directory: %w", err) } + + // Check if FTS already has data - skip populate migration if so + var ftsCount int + _ = p.db.QueryRow("SELECT COUNT(*) FROM fts_embeddings").Scan(&ftsCount) + skipFTSMigration := ftsCount > 0 + // Execute each .up.sql file for _, file := range files { if strings.HasSuffix(file.Name(), ".up.sql") { + // Skip FTS populate migration if already populated + if skipFTSMigration && strings.Contains(file.Name(), "004_populate_fts") { + p.logger.Debug("Skipping FTS migration - already populated", "file", file.Name()) + continue + } err := p.executeMigration(migrationsDir, file.Name()) if err != nil { p.logger.Error("Failed to execute migration %s: %v", file.Name(), err) |
