From 113594915ab0da63375663b0eb0f8803800ffef2 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 9 Jul 2018 16:19:27 +0200 Subject: [PATCH] fix dates in cache --- pandora/item/migrations/0004_json_cache.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandora/item/migrations/0004_json_cache.py b/pandora/item/migrations/0004_json_cache.py index 89962489..8e79c88e 100644 --- a/pandora/item/migrations/0004_json_cache.py +++ b/pandora/item/migrations/0004_json_cache.py @@ -19,4 +19,13 @@ class Migration(migrations.Migration): old_name='json', new_name='cache', ), + migrations.RunSQL( + """UPDATE item_item SET cache = jsonb_set(cache, '{created}', cache->'created'->'__value__', true) WHERE cache @> '{"created": {"__class__": "datetime.datetime"}}'""" + ), + migrations.RunSQL( + """UPDATE item_item SET cache = jsonb_set(cache, '{accessed}', cache->'accessed'->'__value__', true) WHERE cache @> '{"accessed": {"__class__": "datetime.datetime"}}'""" + ), + migrations.RunSQL( + """UPDATE item_item SET cache = jsonb_set(cache, '{modified}', cache->'modified'->'__value__', true) WHERE cache @> '{"modified": {"__class__": "datetime.datetime"}}'""" + ), ]