refactor(database): enforce Alembic-only database migrations, deprecate manual schema migrations
- Create alembic.ini and migrations/env.py for full Alembic CLI + programmatic support - Add Alembic migration 006: detail column on processing_logs - Add Alembic migration 007: ocr_quality_score column + drop unique filehash index - Add Alembic migration 008: performance indexes - Replace _run_schema_migrations() call in init_db() with _run_alembic_upgrade() - Deprecate _run_schema_migrations() with DeprecationWarning - Update tests for new Alembic-based approach and deprecation - Update DatabaseConfiguration.md documentation Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
+73
@@ -0,0 +1,73 @@
|
||||
# Alembic Configuration File
|
||||
# Used for managing database schema migrations in DocuElevate.
|
||||
#
|
||||
# Usage:
|
||||
# alembic upgrade head # Apply all pending migrations
|
||||
# alembic current # Show current revision
|
||||
# alembic history --verbose # Show migration history
|
||||
# alembic downgrade -1 # Roll back one migration
|
||||
# alembic revision --autogenerate -m "description" # Create new migration
|
||||
|
||||
[alembic]
|
||||
# Path to migration scripts
|
||||
script_location = migrations
|
||||
|
||||
# Template used to generate migration file names
|
||||
file_template = %%(rev)s_%%(slug)s
|
||||
|
||||
# Timezone for migration file timestamps (uses UTC by default)
|
||||
# timezone =
|
||||
|
||||
# Maximum length of characters for autogenerate revision names
|
||||
# truncate_slug_length = 40
|
||||
|
||||
# Set to 'true' to run environment during 'revision' command
|
||||
# revision_environment = false
|
||||
|
||||
# Set to 'true' to allow .pyc or .pyo files for migration scripts
|
||||
# sourceless = false
|
||||
|
||||
# Version path separator; default is "os" which uses os.pathsep
|
||||
# version_path_separator = os
|
||||
|
||||
# Output encoding for revision files
|
||||
# output_encoding = utf-8
|
||||
|
||||
# The database URL is loaded from app.config.settings.database_url
|
||||
# in migrations/env.py, not from this file.
|
||||
sqlalchemy.url =
|
||||
|
||||
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic
|
||||
|
||||
[handlers]
|
||||
keys = console
|
||||
|
||||
[formatters]
|
||||
keys = generic
|
||||
|
||||
[logger_root]
|
||||
level = WARN
|
||||
handlers = console
|
||||
qualname =
|
||||
|
||||
[logger_sqlalchemy]
|
||||
level = WARN
|
||||
handlers =
|
||||
qualname = sqlalchemy.engine
|
||||
|
||||
[logger_alembic]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = alembic
|
||||
|
||||
[handler_console]
|
||||
class = StreamHandler
|
||||
args = (sys.stderr,)
|
||||
level = NOTSET
|
||||
formatter = generic
|
||||
|
||||
[formatter_generic]
|
||||
format = %(levelname)-5.5s [%(name)s] %(message)s
|
||||
datefmt = %H:%M:%S
|
||||
Reference in New Issue
Block a user