1 import * as Sequelize from 'sequelize'
3 async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
10 CREATE TABLE IF NOT EXISTS "runnerRegistrationToken"(
12 "registrationToken" varchar(255) NOT NULL,
13 "createdAt" timestamp with time zone NOT NULL,
14 "updatedAt" timestamp with time zone NOT NULL,
19 await utils.sequelize.query(query, { transaction : utils.transaction })
24 CREATE TABLE IF NOT EXISTS "runner"(
26 "runnerToken" varchar(255) NOT NULL,
27 "name" varchar(255) NOT NULL,
28 "description" varchar(1000),
29 "lastContact" timestamp with time zone NOT NULL,
30 "ip" varchar(255) NOT NULL,
31 "runnerRegistrationTokenId" integer REFERENCES "runnerRegistrationToken"("id") ON DELETE CASCADE ON UPDATE CASCADE,
32 "createdAt" timestamp with time zone NOT NULL,
33 "updatedAt" timestamp with time zone NOT NULL,
38 await utils.sequelize.query(query, { transaction : utils.transaction })
43 CREATE TABLE IF NOT EXISTS "runnerJob"(
46 "type" varchar(255) NOT NULL,
47 "payload" jsonb NOT NULL,
48 "privatePayload" jsonb NOT NULL,
49 "state" integer NOT NULL,
50 "failures" integer NOT NULL DEFAULT 0,
51 "error" varchar(5000),
52 "priority" integer NOT NULL,
53 "processingJobToken" varchar(255),
55 "startedAt" timestamp with time zone,
56 "finishedAt" timestamp with time zone,
57 "dependsOnRunnerJobId" integer REFERENCES "runnerJob"("id") ON DELETE CASCADE ON UPDATE CASCADE,
58 "runnerId" integer REFERENCES "runner"("id") ON DELETE SET NULL ON UPDATE CASCADE,
59 "createdAt" timestamp with time zone NOT NULL,
60 "updatedAt" timestamp with time zone NOT NULL,
67 await utils.sequelize.query(query, { transaction : utils.transaction })
71 function down (options) {
72 throw new Error('Not implemented.')