固定文章编码

This commit is contained in:
2026-07-21 15:30:33 +08:00
parent d961538027
commit 83d38956ca
7 changed files with 149 additions and 24 deletions

View File

@@ -175,6 +175,7 @@ drop table if exists article cascade;
create table article (
id int generated by default as identity primary key,
group_id int not null,
code text,
title text not null,
content text,
sort int not null default 0,
@@ -183,6 +184,7 @@ create table article (
updated_at timestamptz default current_timestamp,
deleted_at timestamptz
);
create unique index udx_article_code on article (code) where code is not null and deleted_at is null;
create index idx_article_group_id on article (group_id) where deleted_at is null;
create index idx_article_status on article (status) where deleted_at is null;
create index idx_article_sort on article (sort) where deleted_at is null;
@@ -191,6 +193,7 @@ create index idx_article_sort on article (sort) where deleted_at is null;
comment on table article is '文章表';
comment on column article.id is '文章ID';
comment on column article.group_id is '分组ID';
comment on column article.code is '文章编码,用于固定引用链接';
comment on column article.title is '文章标题';
comment on column article.content is '文章内容';
comment on column article.sort is '文章排序';