-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathinit-broker.sql
99 lines (87 loc) · 3.1 KB
/
init-broker.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
CREATE SCHEMA IF NOT EXISTS broker;
CREATE TABLE IF NOT EXISTS broker.sessions (
beginstring CHAR(8) NOT NULL,
sendercompid VARCHAR(64) NOT NULL,
sendersubid VARCHAR(64) NOT NULL,
senderlocid VARCHAR(64) NOT NULL,
targetcompid VARCHAR(64) NOT NULL,
targetsubid VARCHAR(64) NOT NULL,
targetlocid VARCHAR(64) NOT NULL,
session_qualifier VARCHAR(64) NOT NULL,
creation_time TIMESTAMP NOT NULL,
incoming_seqnum INTEGER NOT NULL,
outgoing_seqnum INTEGER NOT NULL,
PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
targetcompid, targetsubid, targetlocid, session_qualifier)
);
CREATE TABLE IF NOT EXISTS broker.messages (
beginstring CHAR(8) NOT NULL,
sendercompid VARCHAR(64) NOT NULL,
sendersubid VARCHAR(64) NOT NULL,
senderlocid VARCHAR(64) NOT NULL,
targetcompid VARCHAR(64) NOT NULL,
targetsubid VARCHAR(64) NOT NULL,
targetlocid VARCHAR(64) NOT NULL,
session_qualifier VARCHAR(64) NOT NULL,
msgseqnum INTEGER NOT NULL,
message TEXT NOT NULL,
PRIMARY KEY (beginstring, sendercompid, sendersubid, senderlocid,
targetcompid, targetsubid, targetlocid, session_qualifier,
msgseqnum)
);
CREATE SEQUENCE IF NOT EXISTS broker.event_log_sequence;
CREATE TABLE IF NOT EXISTS broker.event_log (
id INTEGER DEFAULT NEXTVAL('broker.event_log_sequence'),
time TIMESTAMP NOT NULL,
beginstring CHAR(8) NOT NULL,
sendercompid VARCHAR(64) NOT NULL,
sendersubid VARCHAR(64) NOT NULL,
senderlocid VARCHAR(64) NOT NULL,
targetcompid VARCHAR(64) NOT NULL,
targetsubid VARCHAR(64) NOT NULL,
targetlocid VARCHAR(64) NOT NULL,
session_qualifier VARCHAR(64),
text TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE SEQUENCE IF NOT EXISTS broker.messages_log_sequence_incoming;
CREATE TABLE IF NOT EXISTS broker.messages_log_incoming (
id INTEGER DEFAULT NEXTVAL('broker.messages_log_sequence_incoming'),
time TIMESTAMP NOT NULL,
beginstring CHAR(8) NOT NULL,
sendercompid VARCHAR(64) NOT NULL,
sendersubid VARCHAR(64) NOT NULL,
senderlocid VARCHAR(64) NOT NULL,
targetcompid VARCHAR(64) NOT NULL,
targetsubid VARCHAR(64) NOT NULL,
targetlocid VARCHAR(64) NOT NULL,
session_qualifier VARCHAR(64),
text TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE SEQUENCE IF NOT EXISTS broker.messages_log_sequence_outgoing;
CREATE TABLE IF NOT EXISTS broker.messages_log_outgoing (
id INTEGER DEFAULT NEXTVAL('broker.messages_log_sequence_outgoing'),
time TIMESTAMP NOT NULL,
beginstring CHAR(8) NOT NULL,
sendercompid VARCHAR(64) NOT NULL,
sendersubid VARCHAR(64) NOT NULL,
senderlocid VARCHAR(64) NOT NULL,
targetcompid VARCHAR(64) NOT NULL,
targetsubid VARCHAR(64) NOT NULL,
targetlocid VARCHAR(64) NOT NULL,
session_qualifier VARCHAR(64),
text TEXT NOT NULL,
PRIMARY KEY (id)
);
CREATE SEQUENCE IF NOT EXISTS broker.orders_sequence;
create table IF NOT EXISTS broker.orders (
ClOrdID integer DEFAULT NEXTVAL('broker.orders_sequence'),
CumQty BIGINT,
OrdStatus char(1),
OrderQty BIGINT,
Price DECIMAL(17,2),
Side char(1),
Symbol varchar(20),
primary key (ClOrdID)
);