Add storage_backend columns to track which backend (minio or filesystem) holds each file, enabling dual-running during migration. Migration 017_file_storage_metadata.sql: - item_files.storage_backend TEXT NOT NULL DEFAULT 'minio' - revisions.file_storage_backend TEXT NOT NULL DEFAULT 'minio' DB repository changes: - Revision struct: add FileStorageBackend field - ItemFile struct: add StorageBackend field - All INSERT queries include the new columns - All SELECT queries read them (COALESCE for pre-migration compat) - CreateRevisionFromExisting copies the backend from source revision - Default to 'minio' when field is empty (backward compat) Existing rows default to 'minio'. New uploads will write 'filesystem' when the filesystem backend is active. Closes #128
8 lines
313 B
SQL
8 lines
313 B
SQL
-- Track which storage backend holds each attached file.
|
|
ALTER TABLE item_files
|
|
ADD COLUMN IF NOT EXISTS storage_backend TEXT NOT NULL DEFAULT 'minio';
|
|
|
|
-- Track which storage backend holds each revision file.
|
|
ALTER TABLE revisions
|
|
ADD COLUMN IF NOT EXISTS file_storage_backend TEXT NOT NULL DEFAULT 'minio';
|