Skip to content
Snippets Groups Projects
Commit be557aff authored by Dariusz Kędzierski's avatar Dariusz Kędzierski
Browse files

json_metadata can contain malformed json (yeah it sucks) so we need to hold it as text

parent ecd829d4
No related branches found
No related tags found
5 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!16Dk issue 3 concurrent block query rebase,!15Dk issue 3 concurrent block query
...@@ -170,7 +170,7 @@ def build_metadata(): ...@@ -170,7 +170,7 @@ def build_metadata():
sa.Column('preview', VARCHAR(1024), nullable=False), sa.Column('preview', VARCHAR(1024), nullable=False),
sa.Column('img_url', VARCHAR(1024), nullable=False), sa.Column('img_url', VARCHAR(1024), nullable=False),
sa.Column('body', TEXT), sa.Column('body', TEXT),
sa.Column('json', sa.JSON) sa.Column('json', TEXT)
) )
sa.Table( sa.Table(
......
...@@ -239,7 +239,7 @@ def _condenser_post_object(row, truncate_body=0): ...@@ -239,7 +239,7 @@ def _condenser_post_object(row, truncate_body=0):
post['title'] = row['title'] post['title'] = row['title']
post['body'] = row['body'][0:truncate_body] if truncate_body else row['body'] 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['created'] = json_date(row['created_at'])
post['updated'] = json_date(row['updated_at']) post['updated'] = json_date(row['updated_at'])
......
...@@ -151,7 +151,7 @@ CREATE TABLE IF NOT EXISTS hive_post_data ( ...@@ -151,7 +151,7 @@ CREATE TABLE IF NOT EXISTS hive_post_data (
preview VARCHAR(1024) NOT NULL, preview VARCHAR(1024) NOT NULL,
img_url VARCHAR(1024) NOT NULL, img_url VARCHAR(1024) NOT NULL,
body TEXT, body TEXT,
json JSON json TEXT
); );
CREATE INDEX IF NOT EXISTS hive_post_data_id_idx ON hive_post_data (id); 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 ( ...@@ -221,7 +221,7 @@ UPDATE hive_posts_new hpn SET (
-- Populate table hive_post_data with bulk data from hive_posts_cache -- 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'; -- 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 -- Populate hive_votes table
-- RAISE NOTICE 'Populate table hive_votes with bulk data from hive_posts_cache'; -- RAISE NOTICE 'Populate table hive_votes with bulk data from hive_posts_cache';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment