diff --git a/contrib/ast-db-manage/queue_log/versions/8e6a9c2f4b17_increase_queue_log_time_precision.py b/contrib/ast-db-manage/queue_log/versions/8e6a9c2f4b17_increase_queue_log_time_precision.py new file mode 100644 index 0000000000..36506ef130 --- /dev/null +++ b/contrib/ast-db-manage/queue_log/versions/8e6a9c2f4b17_increase_queue_log_time_precision.py @@ -0,0 +1,38 @@ +"""increase queue_log time precision + +Revision ID: 8e6a9c2f4b17 +Revises: 4105ee839f58 +Create Date: 2026-08-03 00:00:00.000000 + +""" + +# revision identifiers, used by Alembic. +revision = "8e6a9c2f4b17" +down_revision = "4105ee839f58" + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects.mysql import DATETIME as MYSQL_DATETIME + + +def upgrade(): + # MariaDB is reported as the 'mysql' dialect, so this covers both. + if op.get_context().bind.dialect.name == "mysql": + op.alter_column( + "queue_log", + "time", + existing_type=sa.DateTime(), + type_=MYSQL_DATETIME(fsp=6), + existing_nullable=True, + ) + + +def downgrade(): + if op.get_context().bind.dialect.name == "mysql": + op.alter_column( + "queue_log", + "time", + existing_type=MYSQL_DATETIME(fsp=6), + type_=sa.DateTime(), + existing_nullable=True, + )