26 lines
632 B
SQL
26 lines
632 B
SQL
create table operation
|
|
(
|
|
id serial 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_change_set json
|
|
, undo_change_set json
|
|
);
|
|
|
|
insert into operation (id, redo, undo) values (0, '', '');
|
|
|
|
create table current_operation
|
|
(
|
|
id integer primary key references operation(id) -- must update before delete
|
|
);
|
|
|
|
insert into current_operation (id) values (0);
|
|
|
|
create table snapshot_operation
|
|
(
|
|
id integer primary key references operation(id) on delete cascade
|
|
, tag text not null unique
|
|
);
|