chenhj
4 天以前 4d70e622d2f1786c2ef25fa732bbcec599fe8b14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
-- ----------------------------
-- 附件表
-- ----------------------------
drop table if exists storage_attachment;
CREATE TABLE storage_attachment
(
    id              bigserial PRIMARY KEY,
    create_time     timestamp    default now() NOT NULL,
    update_time     timestamp    default now() NOT NULL,
    deleted         bigint       DEFAULT 0     NOT NULL,
    record_type     smallint     DEFAULT 0     NOT NULL,
    record_id       bigint       DEFAULT 0     NOT NULL,
    name            varchar(100) DEFAULT ''    NOT NULL,
    storage_blob_id bigint       DEFAULT 0     NOT NULL
);
 
COMMENT ON TABLE storage_attachment IS '通用文件上传的附件信息';
 
COMMENT ON COLUMN storage_attachment.record_type IS '关联的记录类型';
COMMENT ON COLUMN storage_attachment.record_id IS '关联的记录id';
COMMENT ON COLUMN storage_attachment.name IS '名称, 如: file, avatar (区分同一条记录不同类型的附件)';
COMMENT ON COLUMN storage_attachment.storage_blob_id IS '关联storage_blob记录id';
 
CREATE INDEX idx_storage_attachment_on_record
    ON storage_attachment (record_type, record_id);