Mercurial > gemma
comparison schema/gemma.sql @ 993:6421c51309eb persistent-import-queue
Added tables for importer queue and respective logging.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 22 Oct 2018 13:03:38 +0200 |
parents | 5f89868bd75e |
children | 75e65599ea52 |
comparison
equal
deleted
inserted
replaced
992:a978b2b26a88 | 993:6421c51309eb |
---|---|
498 OR forecast_generation_time IS NOT NULL), | 498 OR forecast_generation_time IS NOT NULL), |
499 value_lifetime timestamp with time zone, | 499 value_lifetime timestamp with time zone, |
500 CHECK(measure_type = 'minimum guaranteed' | 500 CHECK(measure_type = 'minimum guaranteed' |
501 OR value_lifetime IS NOT NULL) | 501 OR value_lifetime IS NOT NULL) |
502 ) | 502 ) |
503 | |
504 -- | |
505 -- Import queue and respective logging | |
506 -- | |
507 CREATE TYPE import_state AS ENUM ('queued', 'running', 'successful', 'failed') | |
508 | |
509 CREATE TABLE imports ( | |
510 id int PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, | |
511 state import_state NOT NULL DEFAULT 'queued', | |
512 enqueued timestamp NOT NULL DEFAULT now(), | |
513 kind varchar NOT NULL, | |
514 username varchar NOT NULL | |
515 REFERENCES internal.user_profiles(username) | |
516 ON DELETE CASCADE ON UPDATE CASCADE, | |
517 data TEXT | |
518 ) | |
519 | |
520 CREATE TYPE log_type AS ENUM ('info', 'warn', 'error') | |
521 | |
522 CREATE TABLE import_logs ( | |
523 import_id int NOT NULL REFERENCES imports(id), | |
524 time timestamp NOT NULL DEFAULT now(), | |
525 kind log_type NOT NULL DEFAULT 'info', | |
526 msg TEXT NOT NULL | |
527 ) | |
503 ; | 528 ; |
504 | 529 |
505 COMMIT; | 530 COMMIT; |