Upgrade allow adding image in ticket details page comment section
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# A generic, single database configuration.
|
||||
# This file is used by Alembic / Flask-Migrate for logging configuration.
|
||||
# The actual database URL is injected at runtime by env.py via Flask's
|
||||
# current_app — the sqlalchemy.url value here is intentionally a placeholder.
|
||||
|
||||
[alembic]
|
||||
script_location = migrations
|
||||
|
||||
# Placeholder — overridden at runtime by env.py (run_migrations_online).
|
||||
sqlalchemy.url = driver://user:pass@localhost/dbname
|
||||
|
||||
[loggers]
|
||||
keys = root,sqlalchemy,alembic,flask_migrate
|
||||
|
||||
[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
|
||||
|
||||
[logger_flask_migrate]
|
||||
level = INFO
|
||||
handlers =
|
||||
qualname = flask_migrate
|
||||
|
||||
[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
|
||||
+4
-1
@@ -4,7 +4,10 @@ from alembic import context
|
||||
|
||||
config = context.config
|
||||
if config.config_file_name is not None:
|
||||
fileConfig(config.config_file_name)
|
||||
try:
|
||||
fileConfig(config.config_file_name)
|
||||
except FileNotFoundError:
|
||||
pass # alembic.ini absent or CWD mismatch — Flask-Migrate supplies logging elsewhere
|
||||
|
||||
target_metadata = current_app.extensions['migrate'].db.metadata
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
"""Add system_settings table for application-wide configuration flags.
|
||||
|
||||
Revision ID: 002_add_system_settings
|
||||
Revises: 001_widen_ticket_history_values
|
||||
Create Date: 2026-03-30
|
||||
|
||||
Rationale
|
||||
---------
|
||||
Introduces a generic key-value settings store so that runtime configuration
|
||||
flags (such as registration_enabled) can be toggled by administrators through
|
||||
the UI without requiring a code deployment or server restart.
|
||||
|
||||
Apply
|
||||
-----
|
||||
flask db upgrade
|
||||
|
||||
Rollback
|
||||
--------
|
||||
flask db downgrade
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
revision = '002_add_system_settings'
|
||||
down_revision = '001_widen_ticket_history_values'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.create_table(
|
||||
'system_settings',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('key', sa.String(100), nullable=False),
|
||||
sa.Column('value', sa.String(500), nullable=False),
|
||||
sa.Column('description', sa.String(256), nullable=True),
|
||||
sa.Column('updated_at', sa.DateTime(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
)
|
||||
op.create_index('ix_system_settings_key', 'system_settings', ['key'], unique=True)
|
||||
|
||||
# Seed the default: registration is open on fresh installs.
|
||||
op.execute(
|
||||
"INSERT INTO system_settings (key, value, description, updated_at) "
|
||||
"VALUES ('registration_enabled', 'true', "
|
||||
"'Allow new users to self-register via /auth/register', NOW())"
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index('ix_system_settings_key', table_name='system_settings')
|
||||
op.drop_table('system_settings')
|
||||
Reference in New Issue
Block a user