diff --git a/docker-compose/docker-compose-bettershift.yml b/docker-compose/docker-compose-bettershift.yml index e99eea0..1194e8c 100644 --- a/docker-compose/docker-compose-bettershift.yml +++ b/docker-compose/docker-compose-bettershift.yml @@ -5,7 +5,7 @@ name: bettershift services: 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 ports: @@ -19,6 +19,7 @@ services: environment: - TZ=Europe/Prague + - DEFAULT_LOCALE=cs networks: backend: diff --git a/update_bettershift.yml b/update_bettershift.yml index 244e023..ca4e8cc 100644 --- a/update_bettershift.yml +++ b/update_bettershift.yml @@ -52,7 +52,40 @@ integrity = db.execute('PRAGMA integrity_check').fetchall() errors = db.execute('PRAGMA foreign_key_check').fetchall() 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" changed_when: false