重构现代化 FastAPI 后端项目框架

This commit is contained in:
2026-01-21 16:50:57 +08:00
parent 9e06e68a15
commit c56f2fd1db
352 changed files with 176 additions and 70 deletions

View File

@@ -0,0 +1,55 @@
create table operation
(
id bigserial primary key
, redo text not null
, undo text not null
, parent integer references operation(id) on delete cascade
, redo_child integer references operation(id) -- must update before delete
, redo_cs text not null
, undo_cs text not null
);
insert into operation (id, redo, undo, redo_cs, undo_cs) values (0, '', '', '', '');
create table current_operation
(
id bigint primary key references operation(id) -- must update before delete
);
insert into current_operation (id) values (0);
create table snapshot_operation
(
id bigint primary key references operation(id) on delete cascade
, tag text not null unique
);
create table restore_operation
(
id bigint primary key references operation(id) -- set after reading inp
);
insert into restore_operation (id) values (0);
create table batch_operation
(
id bigserial primary key
, redo text not null
, undo text not null
, parent integer references operation(id) on delete cascade
, redo_child integer references operation(id) -- must update before delete
, redo_cs text not null
, undo_cs text not null
);
insert into batch_operation (id, redo, undo, redo_cs, undo_cs) values (0, '', '', '', '');
create type operation_table_option as enum ('operation', 'batch_operation');
create table operation_table
(
option operation_table_option primary key
);
insert into operation_table (option) values ('operation');