chenhj
9 天以前 17badd7ea4d77c0aafbdfa65e05743cb7856489c
ruoyi-common/src/main/resources/db/migration/postgresql/V20250525003447__create_table_storage_attachment.sql
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,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);