Format sql
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
CREATE TYPE API_OPERATION AS ENUM ('init', 'add', 'delete', 'update');
|
||||
create type api_operation as enum ('init', 'add', 'delete', 'update');
|
||||
|
||||
CREATE TABLE OPERATION
|
||||
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[]
|
||||
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', '', '');
|
||||
insert into operation (id, redo, undo, api_id, api_op, api_object_type, api_object_id) values (0, '', '', '', 'init', '', '');
|
||||
|
||||
CREATE TABLE CURRENT_OPERATION
|
||||
create table current_operation
|
||||
(
|
||||
ID INTEGER PRIMARY KEY REFERENCES OPERATION(ID)
|
||||
id integer primary key references operation(id)
|
||||
);
|
||||
|
||||
INSERT INTO CURRENT_OPERATION (ID) VALUES (0);
|
||||
insert into current_operation (id) values (0);
|
||||
|
||||
CREATE TABLE SNAPSHOT_OPERATION
|
||||
create table snapshot_operation
|
||||
(
|
||||
ID INTEGER PRIMARY KEY REFERENCES OPERATION(ID)
|
||||
, Tag TEXT NOT NULL UNIQUE
|
||||
id integer primary key references operation(id)
|
||||
, tag text not null unique
|
||||
);
|
||||
|
||||
CREATE TABLE TRANSACTION_OPERATION
|
||||
create table transaction_operation
|
||||
(
|
||||
ID INTEGER PRIMARY KEY REFERENCES OPERATION(ID)
|
||||
, STRICT BOOLEAN NOT NULL DEFAULT FALSE
|
||||
id integer primary key references operation(id)
|
||||
, strict boolean not null default false
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user