Files
data-engine/sql/10_tencent_audio.sql
2026-05-06 16:19:22 +08:00

47 lines
2.0 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 腾讯广告音乐素材表
CREATE SEQUENCE IF NOT EXISTS tencent_audio_id_seq START WITH 1 INCREMENT BY 1;
CREATE TABLE IF NOT EXISTS tencent_audio (
id BIGINT NOT NULL DEFAULT nextval('tencent_audio_id_seq'::regclass),
tenant_id BIGINT NOT NULL DEFAULT 0,
creator VARCHAR(100) DEFAULT '',
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
updater VARCHAR(100) DEFAULT '',
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
deleted_at TIMESTAMP WITH TIME ZONE,
-- 业务字段
audio_id VARCHAR(100) NOT NULL,
cover_image_url TEXT,
audio_name VARCHAR(500),
author VARCHAR(200),
duration NUMERIC(10, 2),
expire_time BIGINT,
feel_tags JSONB,
genre_tags JSONB,
PRIMARY KEY (id)
);
COMMENT ON TABLE tencent_audio IS '腾讯广告音乐素材表';
COMMENT ON COLUMN tencent_audio.id IS '主键ID';
COMMENT ON COLUMN tencent_audio.tenant_id IS '租户ID';
COMMENT ON COLUMN tencent_audio.creator IS '创建人';
COMMENT ON COLUMN tencent_audio.created_at IS '创建时间';
COMMENT ON COLUMN tencent_audio.updater IS '更新人';
COMMENT ON COLUMN tencent_audio.updated_at IS '更新时间';
COMMENT ON COLUMN tencent_audio.deleted_at IS '软删除时间';
COMMENT ON COLUMN tencent_audio.audio_id IS '音乐ID';
COMMENT ON COLUMN tencent_audio.cover_image_url IS '封面图片URL';
COMMENT ON COLUMN tencent_audio.audio_name IS '音乐名称';
COMMENT ON COLUMN tencent_audio.author IS '作者';
COMMENT ON COLUMN tencent_audio.duration IS '时长(秒)';
COMMENT ON COLUMN tencent_audio.expire_time IS '过期时间戳';
COMMENT ON COLUMN tencent_audio.feel_tags IS '情感标签数组';
COMMENT ON COLUMN tencent_audio.genre_tags IS '风格标签数组';
-- 唯一索引根据audio_id判断是否存在
CREATE UNIQUE INDEX idx_tencent_audio_audio_id ON tencent_audio(tenant_id, audio_id);
CREATE INDEX idx_tencent_audio_author ON tencent_audio(tenant_id, author);
CREATE INDEX idx_tencent_audio_expire_time ON tencent_audio(expire_time);