ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

79 lines
2.2 KiB

  1. import * as Sequelize from 'sequelize'
  2. async function up (utils: {
  3. transaction: Sequelize.Transaction
  4. queryInterface: Sequelize.QueryInterface
  5. sequelize: Sequelize.Sequelize
  6. }): Promise<void> {
  7. {
  8. const query = `
  9. CREATE TABLE IF NOT EXISTS "runnerRegistrationToken"(
  10. "id" serial,
  11. "registrationToken" varchar(255) NOT NULL,
  12. "createdAt" timestamp with time zone NOT NULL,
  13. "updatedAt" timestamp with time zone NOT NULL,
  14. PRIMARY KEY ("id")
  15. );
  16. `
  17. await utils.sequelize.query(query, { transaction : utils.transaction })
  18. }
  19. {
  20. const query = `
  21. CREATE TABLE IF NOT EXISTS "runner"(
  22. "id" serial,
  23. "runnerToken" varchar(255) NOT NULL,
  24. "name" varchar(255) NOT NULL,
  25. "description" varchar(1000),
  26. "lastContact" timestamp with time zone NOT NULL,
  27. "ip" varchar(255) NOT NULL,
  28. "runnerRegistrationTokenId" integer REFERENCES "runnerRegistrationToken"("id") ON DELETE CASCADE ON UPDATE CASCADE,
  29. "createdAt" timestamp with time zone NOT NULL,
  30. "updatedAt" timestamp with time zone NOT NULL,
  31. PRIMARY KEY ("id")
  32. );
  33. `
  34. await utils.sequelize.query(query, { transaction : utils.transaction })
  35. }
  36. {
  37. const query = `
  38. CREATE TABLE IF NOT EXISTS "runnerJob"(
  39. "id" serial,
  40. "uuid" uuid NOT NULL,
  41. "type" varchar(255) NOT NULL,
  42. "payload" jsonb NOT NULL,
  43. "privatePayload" jsonb NOT NULL,
  44. "state" integer NOT NULL,
  45. "failures" integer NOT NULL DEFAULT 0,
  46. "error" varchar(5000),
  47. "priority" integer NOT NULL,
  48. "processingJobToken" varchar(255),
  49. "progress" integer,
  50. "startedAt" timestamp with time zone,
  51. "finishedAt" timestamp with time zone,
  52. "dependsOnRunnerJobId" integer REFERENCES "runnerJob"("id") ON DELETE CASCADE ON UPDATE CASCADE,
  53. "runnerId" integer REFERENCES "runner"("id") ON DELETE SET NULL ON UPDATE CASCADE,
  54. "createdAt" timestamp with time zone NOT NULL,
  55. "updatedAt" timestamp with time zone NOT NULL,
  56. PRIMARY KEY ("id")
  57. );
  58. `
  59. await utils.sequelize.query(query, { transaction : utils.transaction })
  60. }
  61. }
  62. function down (options) {
  63. throw new Error('Not implemented.')
  64. }
  65. export {
  66. up,
  67. down
  68. }