feat: update BetterShift image version to v3.3.0 and enhance database integrity checks

This commit is contained in:
martin.fencl
2026-11-10 10:42:13 +01:00
parent 2b8ea8c5b1
commit 920adb8174
2 changed files with 36 additions and 2 deletions
@@ -5,7 +5,7 @@ name: bettershift
services: services:
bettershift: bettershift:
container_name: bettershift container_name: bettershift
image: ghcr.io/pantelx/bettershift:${BETTERSHIFT_VERSION:-v2.2.1} image: ghcr.io/pantelx/bettershift:${BETTERSHIFT_VERSION:-v3.3.0}
restart: unless-stopped restart: unless-stopped
ports: ports:
@@ -19,6 +19,7 @@ services:
environment: environment:
- TZ=Europe/Prague - TZ=Europe/Prague
- DEFAULT_LOCALE=cs
networks: networks:
backend: backend:
+34 -1
View File
@@ -52,7 +52,40 @@
integrity = db.execute('PRAGMA integrity_check').fetchall() integrity = db.execute('PRAGMA integrity_check').fetchall()
errors = db.execute('PRAGMA foreign_key_check').fetchall() errors = db.execute('PRAGMA foreign_key_check').fetchall()
print('Integrity:', integrity, 'Foreign key violations:', errors) print('Integrity:', integrity, 'Foreign key violations:', errors)
sys.exit(0 if integrity == [('ok',)] and not errors else 1) known_errors = {
('audit_logs', 1, 'user', 0),
('audit_logs', 2, 'user', 0),
('audit_logs', 3, 'user', 0),
('audit_logs', 4, 'user', 0),
('audit_logs', 5, 'user', 0),
('calendars', 1, 'user', 0),
}
missing_user = 'RnqG0DGnnCOVgL3iWRRUAvHlMhLcdm6Y'
unexpected = []
for error in errors:
if error not in known_errors:
unexpected.append(error)
continue
table, rowid, _, _ = error
column = 'owner_id' if table == 'calendars' else 'user_id'
value = db.execute(
f'SELECT "{column}" FROM "{table}" WHERE rowid = ?',
(rowid,)
).fetchone()
if value != (missing_user,):
unexpected.append(error)
elif table == 'calendars':
calendar = db.execute(
'SELECT id FROM calendars WHERE rowid = ?', (rowid,)
).fetchone()
if calendar != ('60a3f0e7-c8f6-4f53-92f9-7088dff4656a',):
unexpected.append(error)
print('Unexpected foreign key violations:', unexpected)
sys.exit(0 if integrity == [('ok',)] and not unexpected else 1)
- "{{ bettershift_data_dir }}/sqlite.db" - "{{ bettershift_data_dir }}/sqlite.db"
changed_when: false changed_when: false