@oneuptime/common 7.0.4922 → 7.0.4972

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/Models/DatabaseModels/CallLog.ts +578 -0
  2. package/Models/DatabaseModels/EmailLog.ts +579 -0
  3. package/Models/DatabaseModels/IncidentStateTimeline.ts +1 -1
  4. package/Models/DatabaseModels/Index.ts +4 -0
  5. package/Models/DatabaseModels/PushNotificationLog.ts +877 -0
  6. package/Models/DatabaseModels/SmsLog.ts +578 -0
  7. package/Models/DatabaseModels/WorkspaceNotificationLog.ts +931 -0
  8. package/Server/API/StatusPageAPI.ts +2 -0
  9. package/Server/API/UserPushAPI.ts +12 -1
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/1754776130988-MigrationName.ts +259 -0
  11. package/Server/Infrastructure/Postgres/SchemaMigrations/1754828812691-MigrationName.ts +105 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1754910440587-MigrationName.ts +105 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1755030730926-MigrationName.ts +101 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1755088852971-MigrationName.ts +371 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1755093133870-MigrationName.ts +29 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1755109893911-MigrationName.ts +23 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/1755110936888-MigrationName.ts +41 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +16 -0
  19. package/Server/Services/CallService.ts +26 -1
  20. package/Server/Services/Index.ts +2 -0
  21. package/Server/Services/MailService.ts +60 -0
  22. package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +6 -0
  23. package/Server/Services/OnCallDutyPolicyScheduleService.ts +12 -0
  24. package/Server/Services/ProjectService.ts +3 -7
  25. package/Server/Services/PushNotificationLogService.ts +14 -0
  26. package/Server/Services/PushNotificationService.ts +129 -13
  27. package/Server/Services/ScheduledMaintenanceService.ts +4 -0
  28. package/Server/Services/SmsService.ts +25 -0
  29. package/Server/Services/StatusPagePrivateUserService.ts +1 -0
  30. package/Server/Services/StatusPageService.ts +1 -0
  31. package/Server/Services/StatusPageSubscriberService.ts +3 -0
  32. package/Server/Services/TeamMemberService.ts +1 -0
  33. package/Server/Services/UserCallService.ts +1 -0
  34. package/Server/Services/UserEmailService.ts +1 -0
  35. package/Server/Services/UserNotificationRuleService.ts +85 -6
  36. package/Server/Services/UserNotificationSettingService.ts +58 -0
  37. package/Server/Services/UserOnCallLogService.ts +1 -0
  38. package/Server/Services/UserSmsService.ts +1 -0
  39. package/Server/Services/WorkspaceNotificationLogService.ts +276 -0
  40. package/Server/Services/WorkspaceNotificationRuleService.ts +290 -33
  41. package/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts +21 -6
  42. package/Server/Utils/Workspace/Slack/Actions/Alert.ts +66 -0
  43. package/Server/Utils/Workspace/Slack/Actions/Incident.ts +66 -1
  44. package/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.ts +65 -0
  45. package/Server/Utils/Workspace/Slack/Slack.ts +21 -6
  46. package/Types/Permission.ts +20 -0
  47. package/Types/PushNotification/PushNotificationRequest.ts +4 -1
  48. package/Types/PushNotification/PushStatus.ts +6 -0
  49. package/Types/Workspace/WorkspaceNotificationActionType.ts +8 -0
  50. package/Types/Workspace/WorkspaceNotificationStatus.ts +6 -0
  51. package/Typings/elkjs.d.ts +30 -0
  52. package/UI/Components/Detail/Detail.tsx +1 -1
  53. package/UI/Components/Graphs/ServiceDependencyGraph.tsx +281 -0
  54. package/UI/Components/Tabs/Tab.tsx +8 -9
  55. package/UI/Components/Tabs/Tabs.tsx +17 -16
  56. package/Utils/Uptime/UptimeUtil.ts +20 -1
  57. package/build/dist/Models/DatabaseModels/CallLog.js +580 -0
  58. package/build/dist/Models/DatabaseModels/CallLog.js.map +1 -1
  59. package/build/dist/Models/DatabaseModels/EmailLog.js +580 -0
  60. package/build/dist/Models/DatabaseModels/EmailLog.js.map +1 -1
  61. package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js +1 -1
  62. package/build/dist/Models/DatabaseModels/IncidentStateTimeline.js.map +1 -1
  63. package/build/dist/Models/DatabaseModels/Index.js +4 -0
  64. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  65. package/build/dist/Models/DatabaseModels/PushNotificationLog.js +904 -0
  66. package/build/dist/Models/DatabaseModels/PushNotificationLog.js.map +1 -0
  67. package/build/dist/Models/DatabaseModels/SmsLog.js +580 -0
  68. package/build/dist/Models/DatabaseModels/SmsLog.js.map +1 -1
  69. package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js +961 -0
  70. package/build/dist/Models/DatabaseModels/WorkspaceNotificationLog.js.map +1 -0
  71. package/build/dist/Server/API/StatusPageAPI.js +2 -0
  72. package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
  73. package/build/dist/Server/API/UserPushAPI.js +9 -1
  74. package/build/dist/Server/API/UserPushAPI.js.map +1 -1
  75. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754776130988-MigrationName.js +104 -0
  76. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754776130988-MigrationName.js.map +1 -0
  77. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754828812691-MigrationName.js +42 -0
  78. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754828812691-MigrationName.js.map +1 -0
  79. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754910440587-MigrationName.js +42 -0
  80. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1754910440587-MigrationName.js.map +1 -0
  81. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755030730926-MigrationName.js +44 -0
  82. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755030730926-MigrationName.js.map +1 -0
  83. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755088852971-MigrationName.js +134 -0
  84. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755088852971-MigrationName.js.map +1 -0
  85. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755093133870-MigrationName.js +16 -0
  86. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755093133870-MigrationName.js.map +1 -0
  87. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755109893911-MigrationName.js +14 -0
  88. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755109893911-MigrationName.js.map +1 -0
  89. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755110936888-MigrationName.js +20 -0
  90. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1755110936888-MigrationName.js.map +1 -0
  91. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +16 -0
  92. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  93. package/build/dist/Server/Services/CallService.js +12 -1
  94. package/build/dist/Server/Services/CallService.js.map +1 -1
  95. package/build/dist/Server/Services/Index.js +2 -0
  96. package/build/dist/Server/Services/Index.js.map +1 -1
  97. package/build/dist/Server/Services/MailService.js +37 -0
  98. package/build/dist/Server/Services/MailService.js.map +1 -1
  99. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +4 -0
  100. package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
  101. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +9 -0
  102. package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
  103. package/build/dist/Server/Services/ProjectService.js +3 -5
  104. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  105. package/build/dist/Server/Services/PushNotificationLogService.js +13 -0
  106. package/build/dist/Server/Services/PushNotificationLogService.js.map +1 -0
  107. package/build/dist/Server/Services/PushNotificationService.js +98 -13
  108. package/build/dist/Server/Services/PushNotificationService.js.map +1 -1
  109. package/build/dist/Server/Services/ScheduledMaintenanceService.js +4 -0
  110. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  111. package/build/dist/Server/Services/SmsService.js +12 -1
  112. package/build/dist/Server/Services/SmsService.js.map +1 -1
  113. package/build/dist/Server/Services/StatusPagePrivateUserService.js +1 -0
  114. package/build/dist/Server/Services/StatusPagePrivateUserService.js.map +1 -1
  115. package/build/dist/Server/Services/StatusPageService.js +1 -0
  116. package/build/dist/Server/Services/StatusPageService.js.map +1 -1
  117. package/build/dist/Server/Services/StatusPageSubscriberService.js +3 -0
  118. package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
  119. package/build/dist/Server/Services/TeamMemberService.js +1 -0
  120. package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
  121. package/build/dist/Server/Services/UserCallService.js +1 -0
  122. package/build/dist/Server/Services/UserCallService.js.map +1 -1
  123. package/build/dist/Server/Services/UserEmailService.js +1 -0
  124. package/build/dist/Server/Services/UserEmailService.js.map +1 -1
  125. package/build/dist/Server/Services/UserNotificationRuleService.js +70 -6
  126. package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
  127. package/build/dist/Server/Services/UserNotificationSettingService.js +43 -0
  128. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  129. package/build/dist/Server/Services/UserOnCallLogService.js +1 -0
  130. package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
  131. package/build/dist/Server/Services/UserSmsService.js +1 -0
  132. package/build/dist/Server/Services/UserSmsService.js.map +1 -1
  133. package/build/dist/Server/Services/WorkspaceNotificationLogService.js +181 -0
  134. package/build/dist/Server/Services/WorkspaceNotificationLogService.js.map +1 -0
  135. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js +193 -3
  136. package/build/dist/Server/Services/WorkspaceNotificationRuleService.js.map +1 -1
  137. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js +19 -6
  138. package/build/dist/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.js.map +1 -1
  139. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js +48 -0
  140. package/build/dist/Server/Utils/Workspace/Slack/Actions/Alert.js.map +1 -1
  141. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js +48 -1
  142. package/build/dist/Server/Utils/Workspace/Slack/Actions/Incident.js.map +1 -1
  143. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js +47 -0
  144. package/build/dist/Server/Utils/Workspace/Slack/Actions/ScheduledMaintenance.js.map +1 -1
  145. package/build/dist/Server/Utils/Workspace/Slack/Slack.js +19 -6
  146. package/build/dist/Server/Utils/Workspace/Slack/Slack.js.map +1 -1
  147. package/build/dist/Types/Permission.js +16 -0
  148. package/build/dist/Types/Permission.js.map +1 -1
  149. package/build/dist/Types/PushNotification/PushStatus.js +7 -0
  150. package/build/dist/Types/PushNotification/PushStatus.js.map +1 -0
  151. package/build/dist/Types/Workspace/WorkspaceNotificationActionType.js +9 -0
  152. package/build/dist/Types/Workspace/WorkspaceNotificationActionType.js.map +1 -0
  153. package/build/dist/Types/Workspace/WorkspaceNotificationStatus.js +7 -0
  154. package/build/dist/Types/Workspace/WorkspaceNotificationStatus.js.map +1 -0
  155. package/build/dist/UI/Components/Detail/Detail.js +1 -1
  156. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  157. package/build/dist/UI/Components/Graphs/ServiceDependencyGraph.js +206 -0
  158. package/build/dist/UI/Components/Graphs/ServiceDependencyGraph.js.map +1 -0
  159. package/build/dist/UI/Components/Tabs/Tab.js +6 -5
  160. package/build/dist/UI/Components/Tabs/Tab.js.map +1 -1
  161. package/build/dist/UI/Components/Tabs/Tabs.js +5 -6
  162. package/build/dist/UI/Components/Tabs/Tabs.js.map +1 -1
  163. package/build/dist/Utils/Uptime/UptimeUtil.js +10 -1
  164. package/build/dist/Utils/Uptime/UptimeUtil.js.map +1 -1
  165. package/package.json +2 -1
@@ -2357,6 +2357,7 @@ export default class StatusPageAPI extends BaseAPI<
2357
2357
  statusPage.smtpConfig,
2358
2358
  ),
2359
2359
  projectId: statusPage.projectId!,
2360
+ statusPageId: statusPage.id!,
2360
2361
  },
2361
2362
  );
2362
2363
  }
@@ -2372,6 +2373,7 @@ export default class StatusPageAPI extends BaseAPI<
2372
2373
  customTwilioConfig: ProjectCallSMSConfigService.toTwilioConfig(
2373
2374
  statusPage.callSmsConfig,
2374
2375
  ),
2376
+ statusPageId: statusPage.id!,
2375
2377
  }).catch((err: Error) => {
2376
2378
  logger.error(err);
2377
2379
  });
@@ -127,9 +127,11 @@ export default class UserPushAPI extends BaseAPI<
127
127
  },
128
128
  select: {
129
129
  userId: true,
130
+ deviceName: true,
130
131
  deviceToken: true,
131
132
  deviceType: true,
132
133
  isVerified: true,
134
+ projectId: true,
133
135
  },
134
136
  });
135
137
 
@@ -174,12 +176,21 @@ export default class UserPushAPI extends BaseAPI<
174
176
 
175
177
  await PushNotificationService.sendPushNotification(
176
178
  {
177
- deviceTokens: [device.deviceToken!],
179
+ devices: [
180
+ {
181
+ token: device.deviceToken!,
182
+ ...(device.deviceName && {
183
+ name: device.deviceName,
184
+ }),
185
+ },
186
+ ],
178
187
  message: testMessage,
179
188
  deviceType: device.deviceType!,
180
189
  },
181
190
  {
182
191
  isSensitive: false,
192
+ projectId: device.projectId!,
193
+ userId: device.userId!,
183
194
  },
184
195
  );
185
196
 
@@ -0,0 +1,259 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1754776130988 implements MigrationInterface {
4
+ public name = "MigrationName1754776130988";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE "CallLog" ADD "incidentId" uuid`);
8
+ await queryRunner.query(`ALTER TABLE "CallLog" ADD "alertId" uuid`);
9
+ await queryRunner.query(
10
+ `ALTER TABLE "CallLog" ADD "scheduledMaintenanceId" uuid`,
11
+ );
12
+ await queryRunner.query(`ALTER TABLE "CallLog" ADD "statusPageId" uuid`);
13
+ await queryRunner.query(
14
+ `ALTER TABLE "CallLog" ADD "statusPageAnnouncementId" uuid`,
15
+ );
16
+ await queryRunner.query(`ALTER TABLE "EmailLog" ADD "incidentId" uuid`);
17
+ await queryRunner.query(`ALTER TABLE "EmailLog" ADD "alertId" uuid`);
18
+ await queryRunner.query(
19
+ `ALTER TABLE "EmailLog" ADD "scheduledMaintenanceId" uuid`,
20
+ );
21
+ await queryRunner.query(`ALTER TABLE "EmailLog" ADD "statusPageId" uuid`);
22
+ await queryRunner.query(
23
+ `ALTER TABLE "EmailLog" ADD "statusPageAnnouncementId" uuid`,
24
+ );
25
+ await queryRunner.query(`ALTER TABLE "SmsLog" ADD "incidentId" uuid`);
26
+ await queryRunner.query(`ALTER TABLE "SmsLog" ADD "alertId" uuid`);
27
+ await queryRunner.query(
28
+ `ALTER TABLE "SmsLog" ADD "scheduledMaintenanceId" uuid`,
29
+ );
30
+ await queryRunner.query(`ALTER TABLE "SmsLog" ADD "statusPageId" uuid`);
31
+ await queryRunner.query(
32
+ `ALTER TABLE "SmsLog" ADD "statusPageAnnouncementId" uuid`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
39
+ );
40
+ await queryRunner.query(
41
+ `CREATE INDEX "IDX_a3c1be70374eb2d7bd4197b4e5" ON "CallLog" ("incidentId") `,
42
+ );
43
+ await queryRunner.query(
44
+ `CREATE INDEX "IDX_cbcb36c6bf371312ed3b4480d7" ON "CallLog" ("alertId") `,
45
+ );
46
+ await queryRunner.query(
47
+ `CREATE INDEX "IDX_9b351b484c705ed28ff70c63da" ON "CallLog" ("scheduledMaintenanceId") `,
48
+ );
49
+ await queryRunner.query(
50
+ `CREATE INDEX "IDX_52a2817222b04d171238c8d26f" ON "CallLog" ("statusPageId") `,
51
+ );
52
+ await queryRunner.query(
53
+ `CREATE INDEX "IDX_c97514eeb34172cce672ebc4b4" ON "CallLog" ("statusPageAnnouncementId") `,
54
+ );
55
+ await queryRunner.query(
56
+ `CREATE INDEX "IDX_958516eeac015e262300985222" ON "EmailLog" ("incidentId") `,
57
+ );
58
+ await queryRunner.query(
59
+ `CREATE INDEX "IDX_41488030fe07b21423bf85c905" ON "EmailLog" ("alertId") `,
60
+ );
61
+ await queryRunner.query(
62
+ `CREATE INDEX "IDX_b9230ffb158999e3dc8809f522" ON "EmailLog" ("scheduledMaintenanceId") `,
63
+ );
64
+ await queryRunner.query(
65
+ `CREATE INDEX "IDX_8f7cfcce7b39d0f82f6464eb4a" ON "EmailLog" ("statusPageId") `,
66
+ );
67
+ await queryRunner.query(
68
+ `CREATE INDEX "IDX_a1b7625a277725b4dde4e6914b" ON "EmailLog" ("statusPageAnnouncementId") `,
69
+ );
70
+ await queryRunner.query(
71
+ `CREATE INDEX "IDX_4ac2d86e7aa70bc0f7e56c29e8" ON "SmsLog" ("incidentId") `,
72
+ );
73
+ await queryRunner.query(
74
+ `CREATE INDEX "IDX_9ba525289a633e16eacc9252ba" ON "SmsLog" ("alertId") `,
75
+ );
76
+ await queryRunner.query(
77
+ `CREATE INDEX "IDX_77668eecd28b8adb9bdef350b3" ON "SmsLog" ("scheduledMaintenanceId") `,
78
+ );
79
+ await queryRunner.query(
80
+ `CREATE INDEX "IDX_515845fba2e880ab364efc3f41" ON "SmsLog" ("statusPageId") `,
81
+ );
82
+ await queryRunner.query(
83
+ `CREATE INDEX "IDX_42ee5d4d59b6d029610c45b375" ON "SmsLog" ("statusPageAnnouncementId") `,
84
+ );
85
+ await queryRunner.query(
86
+ `ALTER TABLE "CallLog" ADD CONSTRAINT "FK_a3c1be70374eb2d7bd4197b4e5e" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
87
+ );
88
+ await queryRunner.query(
89
+ `ALTER TABLE "CallLog" ADD CONSTRAINT "FK_cbcb36c6bf371312ed3b4480d7a" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
90
+ );
91
+ await queryRunner.query(
92
+ `ALTER TABLE "CallLog" ADD CONSTRAINT "FK_9b351b484c705ed28ff70c63da5" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
93
+ );
94
+ await queryRunner.query(
95
+ `ALTER TABLE "CallLog" ADD CONSTRAINT "FK_52a2817222b04d171238c8d26fd" FOREIGN KEY ("statusPageId") REFERENCES "StatusPage"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
96
+ );
97
+ await queryRunner.query(
98
+ `ALTER TABLE "CallLog" ADD CONSTRAINT "FK_c97514eeb34172cce672ebc4b40" FOREIGN KEY ("statusPageAnnouncementId") REFERENCES "StatusPageAnnouncement"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
99
+ );
100
+ await queryRunner.query(
101
+ `ALTER TABLE "EmailLog" ADD CONSTRAINT "FK_958516eeac015e2623009852228" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
102
+ );
103
+ await queryRunner.query(
104
+ `ALTER TABLE "EmailLog" ADD CONSTRAINT "FK_41488030fe07b21423bf85c9058" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
105
+ );
106
+ await queryRunner.query(
107
+ `ALTER TABLE "EmailLog" ADD CONSTRAINT "FK_b9230ffb158999e3dc8809f5228" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
108
+ );
109
+ await queryRunner.query(
110
+ `ALTER TABLE "EmailLog" ADD CONSTRAINT "FK_8f7cfcce7b39d0f82f6464eb4a4" FOREIGN KEY ("statusPageId") REFERENCES "StatusPage"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
111
+ );
112
+ await queryRunner.query(
113
+ `ALTER TABLE "EmailLog" ADD CONSTRAINT "FK_a1b7625a277725b4dde4e6914b2" FOREIGN KEY ("statusPageAnnouncementId") REFERENCES "StatusPageAnnouncement"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
114
+ );
115
+ await queryRunner.query(
116
+ `ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_4ac2d86e7aa70bc0f7e56c29e87" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
117
+ );
118
+ await queryRunner.query(
119
+ `ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_9ba525289a633e16eacc9252ba3" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
120
+ );
121
+ await queryRunner.query(
122
+ `ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_77668eecd28b8adb9bdef350b3b" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
123
+ );
124
+ await queryRunner.query(
125
+ `ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_515845fba2e880ab364efc3f414" FOREIGN KEY ("statusPageId") REFERENCES "StatusPage"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
126
+ );
127
+ await queryRunner.query(
128
+ `ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_42ee5d4d59b6d029610c45b3757" FOREIGN KEY ("statusPageAnnouncementId") REFERENCES "StatusPageAnnouncement"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
129
+ );
130
+ }
131
+
132
+ public async down(queryRunner: QueryRunner): Promise<void> {
133
+ await queryRunner.query(
134
+ `ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_42ee5d4d59b6d029610c45b3757"`,
135
+ );
136
+ await queryRunner.query(
137
+ `ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_515845fba2e880ab364efc3f414"`,
138
+ );
139
+ await queryRunner.query(
140
+ `ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_77668eecd28b8adb9bdef350b3b"`,
141
+ );
142
+ await queryRunner.query(
143
+ `ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_9ba525289a633e16eacc9252ba3"`,
144
+ );
145
+ await queryRunner.query(
146
+ `ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_4ac2d86e7aa70bc0f7e56c29e87"`,
147
+ );
148
+ await queryRunner.query(
149
+ `ALTER TABLE "EmailLog" DROP CONSTRAINT "FK_a1b7625a277725b4dde4e6914b2"`,
150
+ );
151
+ await queryRunner.query(
152
+ `ALTER TABLE "EmailLog" DROP CONSTRAINT "FK_8f7cfcce7b39d0f82f6464eb4a4"`,
153
+ );
154
+ await queryRunner.query(
155
+ `ALTER TABLE "EmailLog" DROP CONSTRAINT "FK_b9230ffb158999e3dc8809f5228"`,
156
+ );
157
+ await queryRunner.query(
158
+ `ALTER TABLE "EmailLog" DROP CONSTRAINT "FK_41488030fe07b21423bf85c9058"`,
159
+ );
160
+ await queryRunner.query(
161
+ `ALTER TABLE "EmailLog" DROP CONSTRAINT "FK_958516eeac015e2623009852228"`,
162
+ );
163
+ await queryRunner.query(
164
+ `ALTER TABLE "CallLog" DROP CONSTRAINT "FK_c97514eeb34172cce672ebc4b40"`,
165
+ );
166
+ await queryRunner.query(
167
+ `ALTER TABLE "CallLog" DROP CONSTRAINT "FK_52a2817222b04d171238c8d26fd"`,
168
+ );
169
+ await queryRunner.query(
170
+ `ALTER TABLE "CallLog" DROP CONSTRAINT "FK_9b351b484c705ed28ff70c63da5"`,
171
+ );
172
+ await queryRunner.query(
173
+ `ALTER TABLE "CallLog" DROP CONSTRAINT "FK_cbcb36c6bf371312ed3b4480d7a"`,
174
+ );
175
+ await queryRunner.query(
176
+ `ALTER TABLE "CallLog" DROP CONSTRAINT "FK_a3c1be70374eb2d7bd4197b4e5e"`,
177
+ );
178
+ await queryRunner.query(
179
+ `DROP INDEX "public"."IDX_42ee5d4d59b6d029610c45b375"`,
180
+ );
181
+ await queryRunner.query(
182
+ `DROP INDEX "public"."IDX_515845fba2e880ab364efc3f41"`,
183
+ );
184
+ await queryRunner.query(
185
+ `DROP INDEX "public"."IDX_77668eecd28b8adb9bdef350b3"`,
186
+ );
187
+ await queryRunner.query(
188
+ `DROP INDEX "public"."IDX_9ba525289a633e16eacc9252ba"`,
189
+ );
190
+ await queryRunner.query(
191
+ `DROP INDEX "public"."IDX_4ac2d86e7aa70bc0f7e56c29e8"`,
192
+ );
193
+ await queryRunner.query(
194
+ `DROP INDEX "public"."IDX_a1b7625a277725b4dde4e6914b"`,
195
+ );
196
+ await queryRunner.query(
197
+ `DROP INDEX "public"."IDX_8f7cfcce7b39d0f82f6464eb4a"`,
198
+ );
199
+ await queryRunner.query(
200
+ `DROP INDEX "public"."IDX_b9230ffb158999e3dc8809f522"`,
201
+ );
202
+ await queryRunner.query(
203
+ `DROP INDEX "public"."IDX_41488030fe07b21423bf85c905"`,
204
+ );
205
+ await queryRunner.query(
206
+ `DROP INDEX "public"."IDX_958516eeac015e262300985222"`,
207
+ );
208
+ await queryRunner.query(
209
+ `DROP INDEX "public"."IDX_c97514eeb34172cce672ebc4b4"`,
210
+ );
211
+ await queryRunner.query(
212
+ `DROP INDEX "public"."IDX_52a2817222b04d171238c8d26f"`,
213
+ );
214
+ await queryRunner.query(
215
+ `DROP INDEX "public"."IDX_9b351b484c705ed28ff70c63da"`,
216
+ );
217
+ await queryRunner.query(
218
+ `DROP INDEX "public"."IDX_cbcb36c6bf371312ed3b4480d7"`,
219
+ );
220
+ await queryRunner.query(
221
+ `DROP INDEX "public"."IDX_a3c1be70374eb2d7bd4197b4e5"`,
222
+ );
223
+ await queryRunner.query(
224
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
225
+ );
226
+ await queryRunner.query(
227
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
228
+ );
229
+ await queryRunner.query(
230
+ `ALTER TABLE "SmsLog" DROP COLUMN "statusPageAnnouncementId"`,
231
+ );
232
+ await queryRunner.query(`ALTER TABLE "SmsLog" DROP COLUMN "statusPageId"`);
233
+ await queryRunner.query(
234
+ `ALTER TABLE "SmsLog" DROP COLUMN "scheduledMaintenanceId"`,
235
+ );
236
+ await queryRunner.query(`ALTER TABLE "SmsLog" DROP COLUMN "alertId"`);
237
+ await queryRunner.query(`ALTER TABLE "SmsLog" DROP COLUMN "incidentId"`);
238
+ await queryRunner.query(
239
+ `ALTER TABLE "EmailLog" DROP COLUMN "statusPageAnnouncementId"`,
240
+ );
241
+ await queryRunner.query(
242
+ `ALTER TABLE "EmailLog" DROP COLUMN "statusPageId"`,
243
+ );
244
+ await queryRunner.query(
245
+ `ALTER TABLE "EmailLog" DROP COLUMN "scheduledMaintenanceId"`,
246
+ );
247
+ await queryRunner.query(`ALTER TABLE "EmailLog" DROP COLUMN "alertId"`);
248
+ await queryRunner.query(`ALTER TABLE "EmailLog" DROP COLUMN "incidentId"`);
249
+ await queryRunner.query(
250
+ `ALTER TABLE "CallLog" DROP COLUMN "statusPageAnnouncementId"`,
251
+ );
252
+ await queryRunner.query(`ALTER TABLE "CallLog" DROP COLUMN "statusPageId"`);
253
+ await queryRunner.query(
254
+ `ALTER TABLE "CallLog" DROP COLUMN "scheduledMaintenanceId"`,
255
+ );
256
+ await queryRunner.query(`ALTER TABLE "CallLog" DROP COLUMN "alertId"`);
257
+ await queryRunner.query(`ALTER TABLE "CallLog" DROP COLUMN "incidentId"`);
258
+ }
259
+ }
@@ -0,0 +1,105 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1754828812691 implements MigrationInterface {
4
+ public name = "MigrationName1754828812691";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "PushNotificationLog" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "title" character varying(500) NOT NULL, "body" text, "deviceType" character varying(100), "statusMessage" character varying(500), "status" character varying(100) NOT NULL, "incidentId" uuid, "alertId" uuid, "scheduledMaintenanceId" uuid, "statusPageId" uuid, "statusPageAnnouncementId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_48b086e2ca3ee9d745ecfe97c41" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_73168664b6ffced71ffa731981" ON "PushNotificationLog" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_59a4b45ae83418ceef477ef459" ON "PushNotificationLog" ("incidentId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_c684177471f5d1a9a3051f21bf" ON "PushNotificationLog" ("alertId") `,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_5ad3e66a90d721ac387a7da5ca" ON "PushNotificationLog" ("scheduledMaintenanceId") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_c48d5589256ff128b0965ab9e7" ON "PushNotificationLog" ("statusPageId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `CREATE INDEX "IDX_c62bb260910d202548e36d7827" ON "PushNotificationLog" ("statusPageAnnouncementId") `,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_73168664b6ffced71ffa7319817" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_59a4b45ae83418ceef477ef4590" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_c684177471f5d1a9a3051f21bf0" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_5ad3e66a90d721ac387a7da5caa" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_c48d5589256ff128b0965ab9e78" FOREIGN KEY ("statusPageId") REFERENCES "StatusPage"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_c62bb260910d202548e36d7827a" FOREIGN KEY ("statusPageAnnouncementId") REFERENCES "StatusPageAnnouncement"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
51
+ );
52
+ await queryRunner.query(
53
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_e891a0077d446c86acee230959d" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
54
+ );
55
+ }
56
+
57
+ public async down(queryRunner: QueryRunner): Promise<void> {
58
+ await queryRunner.query(
59
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_e891a0077d446c86acee230959d"`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_c62bb260910d202548e36d7827a"`,
63
+ );
64
+ await queryRunner.query(
65
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_c48d5589256ff128b0965ab9e78"`,
66
+ );
67
+ await queryRunner.query(
68
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_5ad3e66a90d721ac387a7da5caa"`,
69
+ );
70
+ await queryRunner.query(
71
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_c684177471f5d1a9a3051f21bf0"`,
72
+ );
73
+ await queryRunner.query(
74
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_59a4b45ae83418ceef477ef4590"`,
75
+ );
76
+ await queryRunner.query(
77
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_73168664b6ffced71ffa7319817"`,
78
+ );
79
+ await queryRunner.query(
80
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
81
+ );
82
+ await queryRunner.query(
83
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
84
+ );
85
+ await queryRunner.query(
86
+ `DROP INDEX "public"."IDX_c62bb260910d202548e36d7827"`,
87
+ );
88
+ await queryRunner.query(
89
+ `DROP INDEX "public"."IDX_c48d5589256ff128b0965ab9e7"`,
90
+ );
91
+ await queryRunner.query(
92
+ `DROP INDEX "public"."IDX_5ad3e66a90d721ac387a7da5ca"`,
93
+ );
94
+ await queryRunner.query(
95
+ `DROP INDEX "public"."IDX_c684177471f5d1a9a3051f21bf"`,
96
+ );
97
+ await queryRunner.query(
98
+ `DROP INDEX "public"."IDX_59a4b45ae83418ceef477ef459"`,
99
+ );
100
+ await queryRunner.query(
101
+ `DROP INDEX "public"."IDX_73168664b6ffced71ffa731981"`,
102
+ );
103
+ await queryRunner.query(`DROP TABLE "PushNotificationLog"`);
104
+ }
105
+ }
@@ -0,0 +1,105 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1754910440587 implements MigrationInterface {
4
+ public name = "MigrationName1754910440587";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `CREATE TABLE "WorkspaceNotificationLog" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "workspaceType" character varying(100) NOT NULL, "channelId" character varying(100), "channelName" character varying(100), "threadId" character varying(100), "messageSummary" character varying(500), "statusMessage" character varying(500), "status" character varying(100) NOT NULL, "incidentId" uuid, "alertId" uuid, "scheduledMaintenanceId" uuid, "statusPageId" uuid, "statusPageAnnouncementId" uuid, "deletedByUserId" uuid, CONSTRAINT "PK_8017cedff7ab932c1dc3d9c4c5f" PRIMARY KEY ("_id"))`,
9
+ );
10
+ await queryRunner.query(
11
+ `CREATE INDEX "IDX_88e90b94233cbe8563a4bbfe45" ON "WorkspaceNotificationLog" ("projectId") `,
12
+ );
13
+ await queryRunner.query(
14
+ `CREATE INDEX "IDX_872f735f983a70558c79c78ab7" ON "WorkspaceNotificationLog" ("incidentId") `,
15
+ );
16
+ await queryRunner.query(
17
+ `CREATE INDEX "IDX_346cb35ed758bd44e1e6e7405e" ON "WorkspaceNotificationLog" ("alertId") `,
18
+ );
19
+ await queryRunner.query(
20
+ `CREATE INDEX "IDX_31bc9b6754310f914c30e074d0" ON "WorkspaceNotificationLog" ("scheduledMaintenanceId") `,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_ef2bf686464a74e9d759630b02" ON "WorkspaceNotificationLog" ("statusPageId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `CREATE INDEX "IDX_bf6998abfbf0786aeeb870756f" ON "WorkspaceNotificationLog" ("statusPageAnnouncementId") `,
27
+ );
28
+ await queryRunner.query(
29
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
30
+ );
31
+ await queryRunner.query(
32
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
33
+ );
34
+ await queryRunner.query(
35
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_88e90b94233cbe8563a4bbfe45a" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_872f735f983a70558c79c78ab71" FOREIGN KEY ("incidentId") REFERENCES "Incident"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_346cb35ed758bd44e1e6e7405eb" FOREIGN KEY ("alertId") REFERENCES "Alert"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_31bc9b6754310f914c30e074d00" FOREIGN KEY ("scheduledMaintenanceId") REFERENCES "ScheduledMaintenance"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_ef2bf686464a74e9d759630b02a" FOREIGN KEY ("statusPageId") REFERENCES "StatusPage"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_bf6998abfbf0786aeeb870756f8" FOREIGN KEY ("statusPageAnnouncementId") REFERENCES "StatusPageAnnouncement"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
51
+ );
52
+ await queryRunner.query(
53
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_a99d29c3dfd37e7d2838436f702" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
54
+ );
55
+ }
56
+
57
+ public async down(queryRunner: QueryRunner): Promise<void> {
58
+ await queryRunner.query(
59
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_a99d29c3dfd37e7d2838436f702"`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_bf6998abfbf0786aeeb870756f8"`,
63
+ );
64
+ await queryRunner.query(
65
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_ef2bf686464a74e9d759630b02a"`,
66
+ );
67
+ await queryRunner.query(
68
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_31bc9b6754310f914c30e074d00"`,
69
+ );
70
+ await queryRunner.query(
71
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_346cb35ed758bd44e1e6e7405eb"`,
72
+ );
73
+ await queryRunner.query(
74
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_872f735f983a70558c79c78ab71"`,
75
+ );
76
+ await queryRunner.query(
77
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_88e90b94233cbe8563a4bbfe45a"`,
78
+ );
79
+ await queryRunner.query(
80
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
81
+ );
82
+ await queryRunner.query(
83
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
84
+ );
85
+ await queryRunner.query(
86
+ `DROP INDEX "public"."IDX_bf6998abfbf0786aeeb870756f"`,
87
+ );
88
+ await queryRunner.query(
89
+ `DROP INDEX "public"."IDX_ef2bf686464a74e9d759630b02"`,
90
+ );
91
+ await queryRunner.query(
92
+ `DROP INDEX "public"."IDX_31bc9b6754310f914c30e074d0"`,
93
+ );
94
+ await queryRunner.query(
95
+ `DROP INDEX "public"."IDX_346cb35ed758bd44e1e6e7405e"`,
96
+ );
97
+ await queryRunner.query(
98
+ `DROP INDEX "public"."IDX_872f735f983a70558c79c78ab7"`,
99
+ );
100
+ await queryRunner.query(
101
+ `DROP INDEX "public"."IDX_88e90b94233cbe8563a4bbfe45"`,
102
+ );
103
+ await queryRunner.query(`DROP TABLE "WorkspaceNotificationLog"`);
104
+ }
105
+ }
@@ -0,0 +1,101 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1755030730926 implements MigrationInterface {
4
+ public name = "MigrationName1755030730926";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(`ALTER TABLE "CallLog" ADD "userId" uuid`);
8
+ await queryRunner.query(`ALTER TABLE "EmailLog" ADD "userId" uuid`);
9
+ await queryRunner.query(`ALTER TABLE "SmsLog" ADD "userId" uuid`);
10
+ await queryRunner.query(
11
+ `ALTER TABLE "PushNotificationLog" ADD "userId" uuid`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "WorkspaceNotificationLog" ADD "userId" uuid`,
15
+ );
16
+ await queryRunner.query(
17
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type":"Recurring","value":{"intervalType":"Day","intervalCount":{"_type":"PositiveNumber","value":1}}}'`,
18
+ );
19
+ await queryRunner.query(
20
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type":"RestrictionTimes","value":{"restictionType":"None","dayRestrictionTimes":null,"weeklyRestrictionTimes":[]}}'`,
21
+ );
22
+ await queryRunner.query(
23
+ `CREATE INDEX "IDX_47f0ed650c5e09da943caea60c" ON "CallLog" ("userId") `,
24
+ );
25
+ await queryRunner.query(
26
+ `CREATE INDEX "IDX_d1fb84d0e16365609457eb1c7b" ON "EmailLog" ("userId") `,
27
+ );
28
+ await queryRunner.query(
29
+ `CREATE INDEX "IDX_a2d58057bf9933c84b4fb0bafd" ON "SmsLog" ("userId") `,
30
+ );
31
+ await queryRunner.query(
32
+ `CREATE INDEX "IDX_6da1247dee5e3bfa4cfd4d11ed" ON "PushNotificationLog" ("userId") `,
33
+ );
34
+ await queryRunner.query(
35
+ `CREATE INDEX "IDX_0debc118df807b42cb4b274ff8" ON "WorkspaceNotificationLog" ("userId") `,
36
+ );
37
+ await queryRunner.query(
38
+ `ALTER TABLE "CallLog" ADD CONSTRAINT "FK_47f0ed650c5e09da943caea60c3" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
39
+ );
40
+ await queryRunner.query(
41
+ `ALTER TABLE "EmailLog" ADD CONSTRAINT "FK_d1fb84d0e16365609457eb1c7ba" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
42
+ );
43
+ await queryRunner.query(
44
+ `ALTER TABLE "SmsLog" ADD CONSTRAINT "FK_a2d58057bf9933c84b4fb0bafda" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
45
+ );
46
+ await queryRunner.query(
47
+ `ALTER TABLE "PushNotificationLog" ADD CONSTRAINT "FK_6da1247dee5e3bfa4cfd4d11ed6" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
48
+ );
49
+ await queryRunner.query(
50
+ `ALTER TABLE "WorkspaceNotificationLog" ADD CONSTRAINT "FK_0debc118df807b42cb4b274ff89" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
51
+ );
52
+ }
53
+
54
+ public async down(queryRunner: QueryRunner): Promise<void> {
55
+ await queryRunner.query(
56
+ `ALTER TABLE "WorkspaceNotificationLog" DROP CONSTRAINT "FK_0debc118df807b42cb4b274ff89"`,
57
+ );
58
+ await queryRunner.query(
59
+ `ALTER TABLE "PushNotificationLog" DROP CONSTRAINT "FK_6da1247dee5e3bfa4cfd4d11ed6"`,
60
+ );
61
+ await queryRunner.query(
62
+ `ALTER TABLE "SmsLog" DROP CONSTRAINT "FK_a2d58057bf9933c84b4fb0bafda"`,
63
+ );
64
+ await queryRunner.query(
65
+ `ALTER TABLE "EmailLog" DROP CONSTRAINT "FK_d1fb84d0e16365609457eb1c7ba"`,
66
+ );
67
+ await queryRunner.query(
68
+ `ALTER TABLE "CallLog" DROP CONSTRAINT "FK_47f0ed650c5e09da943caea60c3"`,
69
+ );
70
+ await queryRunner.query(
71
+ `DROP INDEX "public"."IDX_0debc118df807b42cb4b274ff8"`,
72
+ );
73
+ await queryRunner.query(
74
+ `DROP INDEX "public"."IDX_6da1247dee5e3bfa4cfd4d11ed"`,
75
+ );
76
+ await queryRunner.query(
77
+ `DROP INDEX "public"."IDX_a2d58057bf9933c84b4fb0bafd"`,
78
+ );
79
+ await queryRunner.query(
80
+ `DROP INDEX "public"."IDX_d1fb84d0e16365609457eb1c7b"`,
81
+ );
82
+ await queryRunner.query(
83
+ `DROP INDEX "public"."IDX_47f0ed650c5e09da943caea60c"`,
84
+ );
85
+ await queryRunner.query(
86
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "restrictionTimes" SET DEFAULT '{"_type": "RestrictionTimes", "value": {"restictionType": "None", "dayRestrictionTimes": null, "weeklyRestrictionTimes": []}}'`,
87
+ );
88
+ await queryRunner.query(
89
+ `ALTER TABLE "OnCallDutyPolicyScheduleLayer" ALTER COLUMN "rotation" SET DEFAULT '{"_type": "Recurring", "value": {"intervalType": "Day", "intervalCount": {"_type": "PositiveNumber", "value": 1}}}'`,
90
+ );
91
+ await queryRunner.query(
92
+ `ALTER TABLE "WorkspaceNotificationLog" DROP COLUMN "userId"`,
93
+ );
94
+ await queryRunner.query(
95
+ `ALTER TABLE "PushNotificationLog" DROP COLUMN "userId"`,
96
+ );
97
+ await queryRunner.query(`ALTER TABLE "SmsLog" DROP COLUMN "userId"`);
98
+ await queryRunner.query(`ALTER TABLE "EmailLog" DROP COLUMN "userId"`);
99
+ await queryRunner.query(`ALTER TABLE "CallLog" DROP COLUMN "userId"`);
100
+ }
101
+ }