feat(content): 新增运营分类与剧单分类管理
This commit is contained in:
1 parent
758c7521bb
commit
7b360ddccd
26 files changed
+1106
-3
No files matched your search
@@ -0,0 +1,31 @@
|
||||
-- Author: fruit.com.cn
|
||||
-- 运营分类(与「类型」drama_category 是两个概念):分类可自定义增删,并关联多部短剧
|
||||
-- 幂等,仅提交文件,由发布流程执行
|
||||
|
||||
CREATE TABLE IF NOT EXISTS drama_classification (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name VARCHAR(64) NOT NULL,
|
||||
sort INTEGER NOT NULL DEFAULT 0,
|
||||
status SMALLINT NOT NULL DEFAULT 1,
|
||||
created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uk_drama_classification_name ON drama_classification (name);
|
||||
COMMENT ON TABLE drama_classification IS '运营分类;与短剧类型(drama_category)相互独立';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS drama_classification_drama (
|
||||
id BIGINT PRIMARY KEY,
|
||||
classification_id BIGINT NOT NULL,
|
||||
drama_id BIGINT NOT NULL,
|
||||
created_at TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uk_classification_drama
|
||||
ON drama_classification_drama (classification_id, drama_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_classification_drama_drama
|
||||
ON drama_classification_drama (drama_id);
|
||||
COMMENT ON TABLE drama_classification_drama IS '分类与短剧的关联关系';
|
||||
|
||||
DROP TRIGGER IF EXISTS trg_drama_classification_updated_at ON drama_classification;
|
||||
CREATE TRIGGER trg_drama_classification_updated_at
|
||||
BEFORE UPDATE ON drama_classification
|
||||
FOR EACH ROW EXECUTE FUNCTION set_updated_at();
|
||||
Reference in new issue
Block a user