Fix up schemas to work with mariadb

This commit is contained in:
Erik Johnston 2015-03-19 13:42:39 +00:00
parent 89036579ed
commit fae059cc18
15 changed files with 82 additions and 84 deletions

View file

@ -16,12 +16,12 @@
CREATE TABLE IF NOT EXISTS received_transactions(
transaction_id VARCHAR(255),
origin VARCHAR(255),
ts INTEGER,
ts BIGINT,
response_code INTEGER,
response_json BLOB,
has_been_referenced BOOL default 0, -- Whether thishas been referenced by a prev_tx
UNIQUE (transaction_id, origin)
);
) ENGINE = INNODB;
CREATE INDEX IF NOT EXISTS transactions_have_ref ON received_transactions(origin, has_been_referenced);-- WHERE has_been_referenced = 0;
@ -29,13 +29,13 @@ CREATE INDEX IF NOT EXISTS transactions_have_ref ON received_transactions(origin
-- Stores what transactions we've sent, what their response was (if we got one) and whether we have
-- since referenced the transaction in another outgoing transaction
CREATE TABLE IF NOT EXISTS sent_transactions(
id INTEGER PRIMARY KEY, -- This is used to apply insertion ordering
id BIGINT PRIMARY KEY, -- This is used to apply insertion ordering
transaction_id VARCHAR(255),
destination VARCHAR(255),
response_code INTEGER DEFAULT 0,
response_json BLOB,
ts INTEGER
);
) ENGINE = INNODB;
CREATE INDEX IF NOT EXISTS sent_transaction_dest ON sent_transactions(destination);
CREATE INDEX IF NOT EXISTS sent_transaction_dest_referenced ON sent_transactions(destination);
@ -52,13 +52,13 @@ CREATE TABLE IF NOT EXISTS transaction_id_to_pdu(
pdu_id VARCHAR(255),
pdu_origin VARCHAR(255),
UNIQUE (transaction_id, destination)
);
) ENGINE = INNODB;
CREATE INDEX IF NOT EXISTS transaction_id_to_pdu_dest ON transaction_id_to_pdu(destination);
-- To track destination health
CREATE TABLE IF NOT EXISTS destinations(
destination VARCHAR(255) PRIMARY KEY,
retry_last_ts INTEGER,
retry_last_ts BIGINT,
retry_interval INTEGER
);
) ENGINE = INNODB;