2022-08-17 17:45:00 +00:00
|
|
|
CREATE TABLE IF NOT EXISTS api_kgon_synchronization_history (
|
2022-08-18 06:02:23 +00:00
|
|
|
id BIGSERIAL PRIMARY KEY,
|
2022-08-17 17:45:00 +00:00
|
|
|
item TEXT NOT NULL,
|
|
|
|
start_at BIGINT NOT NULL,
|
|
|
|
complete_at BIGINT NOT NULL,
|
2022-08-18 05:57:23 +00:00
|
|
|
code BIGINT NOT NULL,
|
2022-08-17 17:45:00 +00:00
|
|
|
message TEXT,
|
2022-08-30 15:13:29 +00:00
|
|
|
data TEXT,
|
2022-08-17 17:45:00 +00:00
|
|
|
created_at BIGINT NOT NULL DEFAULT (extract(epoch from now()) * 1000)
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE INDEX idx_api_kgon_synchronization_history_item ON api_kgon_synchronization_history (item);
|
2022-08-30 15:13:29 +00:00
|
|
|
CREATE INDEX idx_api_kgon_synchronization_history_created_at ON api_kgon_synchronization_history (created_at);
|
2022-08-17 17:45:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
-- trigger (synchronized_at)
|
|
|
|
CREATE TRIGGER tg_api_kgon_synchronization_history_synchronizations
|
2022-08-18 07:23:28 +00:00
|
|
|
AFTER INSERT
|
2022-08-17 17:45:00 +00:00
|
|
|
ON api_kgon_synchronization_history
|
|
|
|
FOR EACH ROW
|
|
|
|
EXECUTE PROCEDURE update_synchronizations();
|