Widen settings.description to TEXT; run seeders in CI

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.
This commit is contained in:
cproudlock
2026-07-17 20:31:48 -04:00
parent 804c066de4
commit 83141bacb7
4 changed files with 73 additions and 3 deletions

View File

@@ -0,0 +1,61 @@
"""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)