liquid_feedback_core

changeset 600:f61caa45de94

Include column "content_type" of "file" table in UNIQUE index
author jbe
date Thu Feb 06 21:33:01 2020 +0100 (2020-02-06)
parents 81cd9463878f
children aa0620c9c4df
files core.sql
line diff
     1.1 --- a/core.sql	Thu Feb 06 19:17:22 2020 +0100
     1.2 +++ b/core.sql	Thu Feb 06 21:33:01 2020 +0100
     1.3 @@ -55,17 +55,20 @@
     1.4  
     1.5  CREATE TABLE "file" (
     1.6          "id"                    SERIAL8         PRIMARY KEY,
     1.7 -        "hash"                  TEXT            NOT NULL UNIQUE,
     1.8 +        UNIQUE ("content_type", "hash"),
     1.9 +        "content_type"          TEXT            NOT NULL,
    1.10 +        "hash"                  TEXT            NOT NULL,
    1.11          "data"                  BYTEA           NOT NULL,
    1.12 -        "preview_data"          BYTEA,
    1.13 -        "preview_content_type"  TEXT );
    1.14 +        "preview_content_type"  TEXT,
    1.15 +        "preview_data"          BYTEA );
    1.16  
    1.17  COMMENT ON TABLE "file" IS 'Table holding file contents for draft attachments';
    1.18  
    1.19 -COMMENT ON COLUMN "file"."hash"                 IS 'Hash of file contents to avoid storing duplicates';
    1.20 +COMMENT ON COLUMN "file"."content_type"         IS 'Content type of "data"';
    1.21 +COMMENT ON COLUMN "file"."hash"                 IS 'Hash of "data" to avoid storing duplicates where content-type and data is identical';
    1.22  COMMENT ON COLUMN "file"."data"                 IS 'Binary content';
    1.23 +COMMENT ON COLUMN "file"."preview_content_type" IS 'Content type of "preview_data"';
    1.24  COMMENT ON COLUMN "file"."preview_data"         IS 'Preview (e.g. preview image)';
    1.25 -COMMENT ON COLUMN "file"."preview_content_type" IS 'Content type of "preview_data"';
    1.26  
    1.27  
    1.28  CREATE TABLE "member" (
    1.29 @@ -312,7 +315,7 @@
    1.30          "member_id"             INT4            REFERENCES "member" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
    1.31          "image_type"            "member_image_type",
    1.32          "scaled"                BOOLEAN,
    1.33 -        "content_type"          TEXT,
    1.34 +        "content_type"          TEXT,  -- TODO: NOT NULL?
    1.35          "data"                  BYTEA           NOT NULL );
    1.36  
    1.37  COMMENT ON TABLE "member_image" IS 'Images of members';

Impressum / About Us