| 467 | } |
| 468 | |
| 469 | func (s *sqlDatabase) migrateFileObjects() error { |
| 470 | // Only migrate for SQLite backend |
| 471 | if s.cfg.DbBackend != config.SQLiteBackend { |
| 472 | return nil |
| 473 | } |
| 474 | |
| 475 | // Use the separate objects database connection |
| 476 | if s.objectsConn == nil { |
| 477 | return fmt.Errorf("objects database connection not initialized") |
| 478 | } |
| 479 | |
| 480 | // Use GORM AutoMigrate on the separate connection |
| 481 | if err := s.objectsConn.AutoMigrate(&FileObject{}, &FileBlob{}, &FileObjectTag{}); err != nil { |
| 482 | return fmt.Errorf("failed to migrate file objects: %w", err) |
| 483 | } |
| 484 | |
| 485 | return nil |
| 486 | } |
| 487 | |
| 488 | // migrateAutoVacuum converts SQLite databases from auto_vacuum=NONE to |
| 489 | // auto_vacuum=INCREMENTAL. This is a one-time migration that allows the |