Commit cf44a3adbb125a93563fa5e7e352acc49e70b299

Authored by Luan
1 parent 1589f628

adding size field to attachment view

src/proxy/migrations/0003_create_attachment_view.py
@@ -16,10 +16,11 @@ class Migration(DataMigration): @@ -16,10 +16,11 @@ class Migration(DataMigration):
16 CREATE OR REPLACE VIEW attachment_view AS SELECT 16 CREATE OR REPLACE VIEW attachment_view AS SELECT
17 CONCAT(attachment.type, '/' , attachment.id, '/', attachment.filename) AS url, 17 CONCAT(attachment.type, '/' , attachment.id, '/', attachment.filename) AS url,
18 attachment.type AS used_by, 18 attachment.type AS used_by,
19 - attachment.filename as filename, 19 + attachment.filename AS filename,
20 (SELECT LOWER(SUBSTRING(attachment.filename FROM '\w{2,3}$'))) AS mimetype, 20 (SELECT LOWER(SUBSTRING(attachment.filename FROM '\w{2,3}$'))) AS mimetype,
21 - attachment.author as author,  
22 - attachment.description as description, 21 + attachment.author AS author,
  22 + attachment.description AS description,
  23 + attachment.size AS size,
23 TIMESTAMP WITH TIME ZONE 'epoch' + (attachment.time/1000000)* INTERVAL '1s' AS created 24 TIMESTAMP WITH TIME ZONE 'epoch' + (attachment.time/1000000)* INTERVAL '1s' AS created
24 FROM attachment; 25 FROM attachment;
25 ''') 26 ''')