The dualpath_single_machine setting description is 257 chars but settings.description was varchar(255). On strict MySQL 8 an over-length insert is a hard error 1406 (Data too long), so `flask seed settings` failed on a fresh install; older/relaxed MySQL truncated silently and hid it. Widen the column to TEXT (matches value, already TEXT) via core migration 7d26. CI only ran `flask db upgrade` + plugin install, never the seeders, so it missed this. Add a seed step to the migrations-mysql job so a seeded row that violates a column constraint fails CI on strict MySQL 8 instead of shipping.
62 lines
1.7 KiB
Python
62 lines
1.7 KiB
Python
"""Widen settings.description to TEXT (was varchar(255))
|
|
|
|
Seeded setting descriptions are explanatory sentences; some exceed 255 chars
|
|
(e.g. dualpath_single_machine). On strict MySQL 8 an over-length insert is a
|
|
hard error 1406, not a silent truncation, so `flask seed settings` failed on a
|
|
fresh box. TEXT removes the ceiling and matches value, which is already TEXT.
|
|
|
|
Idempotent guard on current column type; real downgrade back to varchar(255).
|
|
|
|
Revision ID: 7d26_settings_description_text
|
|
Revises: 7d25_drop_redundant_indexes
|
|
Create Date: 2026-07-17
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
revision = '7d26_settings_description_text'
|
|
down_revision = '7d25_drop_redundant_indexes'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def _description_type(insp):
|
|
for c in insp.get_columns('settings'):
|
|
if c['name'] == 'description':
|
|
return str(c['type']).upper()
|
|
return None
|
|
|
|
|
|
def upgrade():
|
|
bind = op.get_bind()
|
|
insp = sa.inspect(bind)
|
|
|
|
if 'settings' not in insp.get_table_names():
|
|
return
|
|
coltype = _description_type(insp)
|
|
if coltype is None or 'TEXT' in coltype:
|
|
return
|
|
|
|
op.alter_column('settings', 'description',
|
|
existing_type=sa.String(length=255),
|
|
type_=sa.Text(),
|
|
existing_nullable=True)
|
|
|
|
|
|
def downgrade():
|
|
bind = op.get_bind()
|
|
insp = sa.inspect(bind)
|
|
|
|
if 'settings' not in insp.get_table_names():
|
|
return
|
|
coltype = _description_type(insp)
|
|
if coltype is None or 'TEXT' not in coltype:
|
|
return
|
|
|
|
op.alter_column('settings', 'description',
|
|
existing_type=sa.Text(),
|
|
type_=sa.String(length=255),
|
|
existing_nullable=True)
|