user.settings: force jsonb conversion

This commit is contained in:
Luna 2018-12-06 01:25:39 -03:00
parent b7028d4a7d
commit bcd846d779
2 changed files with 6 additions and 2 deletions

View File

@ -31,13 +31,17 @@ async def patch_current_settings():
for key in j:
val = j[key]
jsonb_cnv = ''
# force postgres to update to jsonb
# when the fields ARE jsonb.
if key in json_fields:
val = json.dumps(val)
jsonb_cnv = '::jsonb'
await app.db.execute(f"""
UPDATE user_settings
SET {key}=$1
SET {key}=$1{jsonb_cnv}
WHERE id = $2
""", val, user_id)

View File

@ -131,7 +131,7 @@ class GatewayWebsocket:
if len(encoded) < 2048:
log.debug('sending\n{}', pprint.pformat(payload))
else:
# log.debug('sending {}', pprint.pformat(payload))
log.debug('sending {}', pprint.pformat(payload))
log.debug('sending op={} s={} t={} (too big)',
payload.get('op'),
payload.get('s'),