Skip to content

Commit

Permalink
Merge pull request #10 from Peatix/ggunson-schema-update
Browse files Browse the repository at this point in the history
Update schema.sql to match production
  • Loading branch information
ggunson authored Jun 1, 2023
2 parents 8d65ebf + cb481dc commit d4cce42
Showing 1 changed file with 48 additions and 40 deletions.
88 changes: 48 additions & 40 deletions doc/schema.sql
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
CREATE TABLE funcmap (
funcid INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
funcname VARCHAR(255) NOT NULL,
UNIQUE(funcname)
);
funcid int(10) unsigned NOT NULL AUTO_INCREMENT,
funcname varchar(255) NOT NULL,
PRIMARY KEY (funcid),
UNIQUE KEY funcname (funcname)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE job (
jobid BIGINT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
funcid INT UNSIGNED NOT NULL,
arg MEDIUMBLOB,
uniqkey VARCHAR(255) NULL,
insert_time INTEGER UNSIGNED,
run_after INTEGER UNSIGNED NOT NULL,
grabbed_until INTEGER UNSIGNED NOT NULL,
priority SMALLINT UNSIGNED,
coalesce VARCHAR(255),
INDEX (funcid, run_after),
UNIQUE(funcid, uniqkey),
INDEX (funcid, coalesce)
);
jobid bigint(20) unsigned NOT NULL AUTO_INCREMENT,
funcid int(10) unsigned NOT NULL,
arg mediumblob,
uniqkey varchar(255) DEFAULT NULL,
insert_time int(10) unsigned DEFAULT NULL,
run_after int(10) unsigned NOT NULL,
grabbed_until int(10) unsigned NOT NULL,
priority smallint(5) unsigned DEFAULT NULL,
coalesce varchar(255) DEFAULT NULL,
PRIMARY KEY (jobid),
UNIQUE KEY funcid_2 (funcid,uniqkey),
KEY funcid (funcid,run_after),
KEY funcid_3 (funcid,coalesce),
KEY idx_run_after_grabbed_until (run_after,grabbed_until),
KEY idx_coalesce (coalesce)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE note (
jobid BIGINT UNSIGNED NOT NULL,
notekey VARCHAR(255),
PRIMARY KEY (jobid, notekey),
value MEDIUMBLOB
);
jobid bigint(20) unsigned NOT NULL,
notekey varchar(255) NOT NULL DEFAULT '',
value mediumblob,
PRIMARY KEY (jobid,notekey)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE error (
error_time INTEGER UNSIGNED NOT NULL,
jobid BIGINT UNSIGNED NOT NULL,
message MEDIUMTEXT NOT NULL,
funcid INT UNSIGNED NOT NULL DEFAULT 0,
INDEX (funcid, error_time),
INDEX (error_time),
INDEX (jobid)
);
error_time int(10) unsigned NOT NULL,
jobid bigint(20) unsigned NOT NULL,
message mediumtext,
funcid int(10) unsigned NOT NULL DEFAULT '0',
KEY funcid (funcid,error_time),
KEY jobid (jobid),
KEY idx_error_time_funcid (error_time,funcid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE exitstatus (
jobid BIGINT UNSIGNED PRIMARY KEY NOT NULL,
funcid INT UNSIGNED NOT NULL DEFAULT 0,
status SMALLINT UNSIGNED,
completion_time INTEGER UNSIGNED,
delete_after INTEGER UNSIGNED,
note MEDIUMTEXT,
elapsed DOUBLE,
INDEX (funcid),
INDEX (delete_after)
);
jobid bigint(20) unsigned NOT NULL,
funcid int(10) unsigned NOT NULL DEFAULT '0',
status smallint(5) unsigned DEFAULT NULL,
completion_time int(10) unsigned DEFAULT NULL,
delete_after int(10) unsigned DEFAULT NULL,
note mediumtext,
elapsed double DEFAULT NULL,
PRIMARY KEY (jobid),
KEY funcid (funcid),
KEY delete_after (delete_after),
KEY idx_funcid_status_completion_time (funcid,status,completion_time),
KEY idx_elapsed (elapsed),
KEY idx_completion_time_funcid_status (completion_time,funcid,status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

0 comments on commit d4cce42

Please sign in to comment.