diff --git a/hive/db/schema.py b/hive/db/schema.py index 9e4722be6bc82daf4b61bfb6f983b2cfdbe50f57..0b52f955bfab3184de83d2d0309ea2f5df43c256 100644 --- a/hive/db/schema.py +++ b/hive/db/schema.py @@ -170,7 +170,7 @@ def build_metadata(): sa.Column('preview', VARCHAR(1024), nullable=False), sa.Column('img_url', VARCHAR(1024), nullable=False), sa.Column('body', TEXT), - sa.Column('json', sa.JSON) + sa.Column('json', TEXT) ) sa.Table( diff --git a/hive/server/bridge_api/objects.py b/hive/server/bridge_api/objects.py index 400f21fd6c1611504dcc80d433c52504444b5b38..d324bb2fb05f6d0c95f5a2c5403698d2831b4fd7 100644 --- a/hive/server/bridge_api/objects.py +++ b/hive/server/bridge_api/objects.py @@ -239,7 +239,7 @@ def _condenser_post_object(row, truncate_body=0): post['title'] = row['title'] post['body'] = row['body'][0:truncate_body] if truncate_body else row['body'] - post['json_metadata'] = json.loads(row['json']) + post['json_metadata'] = row['json'] post['created'] = json_date(row['created_at']) post['updated'] = json_date(row['updated_at']) diff --git a/scripts/update_hivemind_db.sql b/scripts/update_hivemind_db.sql index f0a2db2eadbf492bc78d15ac2b43cd39327508ee..392b9276b9aaf004c5328195c6e69d6d649dbcaa 100644 --- a/scripts/update_hivemind_db.sql +++ b/scripts/update_hivemind_db.sql @@ -151,7 +151,7 @@ CREATE TABLE IF NOT EXISTS hive_post_data ( preview VARCHAR(1024) NOT NULL, img_url VARCHAR(1024) NOT NULL, body TEXT, - json JSON + json TEXT ); CREATE INDEX IF NOT EXISTS hive_post_data_id_idx ON hive_post_data (id); @@ -221,7 +221,7 @@ UPDATE hive_posts_new hpn SET ( -- Populate table hive_post_data with bulk data from hive_posts_cache -- RAISE NOTICE 'Populate table hive_post_data with bulk data from hive_posts_cache'; -INSERT INTO hive_post_data (id, title, preview, img_url, body, votes, json) SELECT post_id, title, preview, img_url, body, json::json FROM hive_posts_cache; +INSERT INTO hive_post_data (id, title, preview, img_url, body, votes, json) SELECT post_id, title, preview, img_url, body, json FROM hive_posts_cache; -- Populate hive_votes table -- RAISE NOTICE 'Populate table hive_votes with bulk data from hive_posts_cache';