Files
query-orchestration/internal/database/migrations/00000000000111_add_documents_folder_fields.down.sql
Jay Brown c10fa98d0a Merged in feature/restore-migrations-v2 (pull request #205)
Restore original migrations (001-120) to fix schema_migrations version mismatch

* Restore original migrations (001-120) to fix schema_migrations version mismatch

The previous migration collapse broke deployed databases because:
- Dev database was at version 120 (the real remove_text_extraction migration)
- Main had collapsed migrations (001-012) + stub files (119_stub, 120_stub)
- The migrate tool couldn't find version 119/120 with matching content

This commit restores the original 27 migrations (versions 001-120) from
before the collapse, ensuring backward compatibility with existing databases.
2026-01-15 23:18:53 +00:00

19 lines
697 B
SQL

-- Rollback: Remove folderId, originalPath columns and related constraints/indexes from documents table
-- Remove comments from folders table
COMMENT ON COLUMN folders.path IS NULL;
COMMENT ON TABLE folders IS NULL;
-- Remove comments from documentEntries table
COMMENT ON COLUMN documentEntries.bucket IS NULL;
COMMENT ON COLUMN documentEntries.key IS NULL;
-- Remove originalPath column
COMMENT ON COLUMN documents.originalPath IS NULL;
ALTER TABLE documents DROP COLUMN IF EXISTS originalPath;
-- Remove folderId column
DROP INDEX IF EXISTS idx_documents_folderid;
ALTER TABLE documents DROP CONSTRAINT IF EXISTS fk_documents_folderid;
ALTER TABLE documents DROP COLUMN IF EXISTS folderId;