Windows installer: payload hash-locking, SBOM, client-IP handling, operator docs
This commit is contained in:
@@ -98,6 +98,31 @@ def preflight():
|
||||
elif version:
|
||||
ok('MySQL 5.7+/8.0 - no extra index flags needed')
|
||||
|
||||
# The database's own default charset. Tables are forced to utf8mb4 by the
|
||||
# compiler hook (shopdb/utils/mysql_charset.py), so a latin1 default does not
|
||||
# break the schema - but anything created OUTSIDE that path inherits it, and
|
||||
# a database created without an explicit CHARSET is the usual cause. Cheap to
|
||||
# check here, invisible until characters come back mangled.
|
||||
if version:
|
||||
try:
|
||||
row = db.session.execute(text(
|
||||
'SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA '
|
||||
'WHERE SCHEMA_NAME = DATABASE()')).fetchone()
|
||||
charset = row[0] if row else None
|
||||
if charset is None:
|
||||
warn('Could not read the database default charset',
|
||||
'Not fatal - tables are forced to utf8mb4 regardless.')
|
||||
elif str(charset).lower() == 'utf8mb4':
|
||||
ok('Database default charset is utf8mb4')
|
||||
else:
|
||||
warn(f'Database default charset is {charset}, not utf8mb4',
|
||||
'Tables this application creates are forced to utf8mb4, so the '
|
||||
'schema is correct. Fix the default so anything created outside '
|
||||
'the migrations matches: ALTER DATABASE <name> CHARACTER SET '
|
||||
'utf8mb4 COLLATE utf8mb4_unicode_ci;')
|
||||
except Exception as exc:
|
||||
warn('Could not read the database default charset', f'({exc})')
|
||||
|
||||
click.echo('')
|
||||
if failures:
|
||||
click.echo(click.style(f'{len(failures)} blocker(s). Fix them before installing.', fg='red', bold=True))
|
||||
|
||||
Reference in New Issue
Block a user