Files
TJWaterServer/script/sql/create/operation.sql
2022-10-09 11:06:19 +08:00

37 lines
911 B
SQL

create type api_operation as enum ('init', 'add', 'delete', 'update');
create table operation
(
id serial primary key
, redo text not null
, undo text not null
, parent integer references operation(id)
, redo_child integer references operation(id)
, api_id text not null
, api_op api_operation not null
, api_object_type text not null
, api_object_id text not null
, api_object_properties text[]
);
insert into operation (id, redo, undo, api_id, api_op, api_object_type, api_object_id) values (0, '', '', '', 'init', '', '');
create table current_operation
(
id integer primary key references operation(id)
);
insert into current_operation (id) values (0);
create table snapshot_operation
(
id integer primary key references operation(id)
, tag text not null unique
);
create table transaction_operation
(
id integer primary key references operation(id)
, strict boolean not null default false
);