-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.sql
23 lines (20 loc) · 907 Bytes
/
table.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- +goose Up
-- SQL in this section is executed when the migration is applied.
CREATE TABLE `tasks` (
`id` char(26) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
`fingerprint` char(8) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
`type` varchar(50) CHARACTER SET ascii COLLATE ascii_bin NOT NULL,
`payload` json NOT NULL,
`retries` tinyint(3) unsigned NOT NULL DEFAULT 0,
`max_retries` tinyint(3) unsigned NOT NULL DEFAULT 10,
`timeout_seconds` int(11) NOT NULL DEFAULT 60,
`created_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
`scheduled_at` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
`claimed_at` datetime(6),
PRIMARY KEY (`id`),
UNIQUE KEY `fingerprint` (`fingerprint`),
KEY `scheduled_at` (`scheduled_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- +goose Down
-- SQL in this section is executed when the migration is rolled back.
DROP TABLE `tasks`;