Last active
June 8, 2022 00:14
-
-
Save pingzh/769c7cf0de8dabdaba73a7aeb97e5c53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `task_instance_audit` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`changedate` TIMESTAMP DEFAULT NULL, | |
`dag_id` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`task_id` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`run_id` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`try_number` int(11) DEFAULT NULL, | |
`state` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`job_id` int(11) DEFAULT NULL, | |
`pool` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`queue` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`operator` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`queued_dttm` TIMESTAMP DEFAULT NULL, | |
`action` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`sql_client` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, | |
`pid` int(11) DEFAULT NULL, | |
PRIMARY KEY (`id`), | |
KEY `task_id` (`task_id`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; | |
CREATE TRIGGER after_task_instance_insert AFTER INSERT ON task_instance | |
FOR EACH ROW | |
INSERT INTO task_instance_audit | |
SET action = 'insert', | |
task_id=NEW.task_id, | |
dag_id=NEW.dag_id, | |
run_id=NEW.run_id, | |
state=NEW.state, | |
try_number=NEW.try_number, | |
job_id=NEW.job_id, | |
pool=NEW.pool, | |
queue=NEW.queue, | |
operator=NEW.operator, | |
queued_dttm=NEW.queued_dttm, | |
changedate = NOW(), | |
sql_client = USER(), | |
pid = NEW.pid | |
CREATE TRIGGER after_task_instance_update AFTER UPDATE ON task_instance | |
FOR EACH ROW | |
INSERT INTO task_instance_audit | |
SET action = 'update', | |
task_id = NEW.task_id, | |
dag_id = NEW.dag_id, | |
run_id = NEW.run_id, | |
state = NEW.state, | |
try_number = NEW.try_number, | |
queue = NEW.queue, | |
queued_dttm = NEW.queued_dttm, | |
changedate = NOW(), | |
sql_client = USER(), | |
pid = NEW.pid | |
CREATE TRIGGER after_task_instance_delete AFTER DELETE ON task_instance | |
FOR EACH ROW | |
INSERT INTO task_instance_audit | |
SET action = 'delete', | |
task_id = OLD.task_id, | |
dag_id = OLD.dag_id, | |
changedate = NOW(), | |
sql_client = USER() | |
CREATE TABLE `scheduling_delay_checkpoint` ( | |
`id` bigint(20) NOT NULL AUTO_INCREMENT, | |
`last_finished_at` timestamp(3) NULL DEFAULT NULL, | |
PRIMARY KEY (`id`) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment