@oneuptime/common 11.3.26 → 11.3.28
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.
- package/Models/DatabaseModels/IncidentEpisodeRoleMember.ts +1 -1
- package/Models/DatabaseModels/IncidentMember.ts +1 -1
- package/Models/DatabaseModels/IncomingCallPolicy.ts +13 -0
- package/Models/DatabaseModels/Index.ts +3 -0
- package/Models/DatabaseModels/MigrationFailure.ts +170 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.ts +51 -2
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.ts +44 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.ts +6 -0
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.ts +6 -0
- package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.ts +1 -1
- package/Models/DatabaseModels/OnCallDutyPolicyUserOverride.ts +2 -2
- package/Server/API/AlertAPI.ts +1 -1
- package/Server/API/IncidentAPI.ts +2 -2
- package/Server/API/IncidentEpisodeAPI.ts +1 -1
- package/Server/API/LlmProviderAPI.ts +1 -0
- package/Server/API/ScheduledMaintenanceAPI.ts +1 -1
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783510935686-FixNotNullForeignKeysOnDelete.ts +81 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783515836148-MigrationName.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.ts +35 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Infrastructure/PostgresDatabase.ts +11 -0
- package/Server/Services/AIService.ts +74 -2
- package/Server/Services/AnalyticsDatabaseService.ts +10 -1
- package/Server/Services/DatabaseService.ts +10 -1
- package/Server/Services/IncidentService.ts +1 -1
- package/Server/Services/IncomingCallPolicyEscalationRuleService.ts +75 -2
- package/Server/Services/IncomingCallPolicyService.ts +42 -1
- package/Server/Services/Index.ts +2 -0
- package/Server/Services/MigrationFailureService.ts +9 -0
- package/Server/Services/MonitorProbeService.ts +33 -7
- package/Server/Services/MonitorService.ts +19 -7
- package/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.ts +65 -0
- package/Server/Services/OnCallDutyPolicyEscalationRuleService.ts +185 -41
- package/Server/Services/OnCallDutyPolicyEscalationRuleUserService.ts +23 -15
- package/Server/Services/OnCallDutyPolicyExecutionLogService.ts +39 -0
- package/Server/Services/OnCallDutyPolicyScheduleLayerService.ts +148 -0
- package/Server/Services/OnCallDutyPolicyScheduleLayerUserService.ts +11 -2
- package/Server/Services/OnCallDutyPolicyScheduleService.ts +502 -26
- package/Server/Services/OnCallDutyPolicyTimeLogService.ts +49 -7
- package/Server/Services/OnCallDutyPolicyUserOverrideService.ts +218 -4
- package/Server/Services/ProjectCallSMSConfigService.ts +82 -1
- package/Server/Services/TeamMemberService.ts +6 -0
- package/Server/Services/UserNotificationRuleService.ts +13 -42
- package/Server/Services/UserOnCallLogService.ts +90 -0
- package/Server/Services/UserOnCallLogTimelineService.ts +43 -1
- package/Server/Types/Database/QueryUtil.ts +57 -0
- package/Server/Utils/AI/AlertAIContextBuilder.ts +6 -1
- package/Server/Utils/AI/Chat/ChatAgentRunner.ts +14 -2
- package/Server/Utils/AI/IncidentAIContextBuilder.ts +18 -3
- package/Server/Utils/AI/IncidentEpisodeAIContextBuilder.ts +6 -1
- package/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.ts +12 -2
- package/Server/Utils/AI/Toolbox/IncidentTools.ts +183 -1
- package/Server/Utils/AI/Toolbox/Index.ts +4 -1
- package/Server/Utils/AI/Toolbox/RecentChangesTools.ts +208 -0
- package/Server/Utils/AI/Toolbox/Serializer.ts +42 -0
- package/Server/Utils/Database/MigrationFailureLog.ts +240 -0
- package/Server/Utils/IncomingCallPhoneNumber.ts +41 -0
- package/Server/Utils/LLM/LLMService.ts +110 -11
- package/Server/Utils/Telemetry/IoTSnapshotScan.ts +12 -9
- package/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.ts +12 -9
- package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +0 -8
- package/Tests/Server/Services/OnCallDutyPolicyScheduleLayerUserReorder.test.ts +233 -0
- package/Tests/Server/Services/OnCallDutyPolicyTimeLogServiceScoping.test.ts +242 -0
- package/Tests/Server/Services/OnCallDutyPolicyUserOverrideEdit.test.ts +198 -0
- package/Tests/Server/Services/UserOnCallLogClaimNotificationRule.test.ts +495 -0
- package/Tests/Server/Types/Database/QueryUtil.test.ts +74 -0
- package/Tests/Server/Utils/AI/LLMServiceToolCalling.test.ts +78 -0
- package/Tests/Server/Utils/AI/ToolResultSerializer.test.ts +68 -0
- package/Tests/Types/DateExhaustiveTimezone.test.ts +700 -0
- package/Tests/Types/DateTimezoneWallClock.test.ts +99 -0
- package/Tests/Types/Events/Recurring.test.ts +22 -9
- package/Tests/Types/OnCallDutyPolicy/LayerUtilAuditFixes.test.ts +291 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilAuditFixesRound2.test.ts +398 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDSTWeekendGap.test.ts +114 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDSTWeeklyDayShift.test.ts +76 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDailyMutation.test.ts +128 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDailyProbe.test.ts +203 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilDiffFuzz.test.ts +322 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilEdgeCases.test.ts +280 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveCurrentUser.test.ts +863 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveDaily.test.ts +900 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveMultiLayer.test.ts +1104 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveRotation.test.ts +957 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilExhaustiveWeekly.test.ts +1095 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilInvariants.test.ts +232 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMergeAudit.test.ts +227 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMonthYearAudit.test.ts +255 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMultiLayerAudit.test.ts +388 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilMultiLayerEdge.test.ts +300 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilOvernightDSTAudit.test.ts +158 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilRestrictedGapFix.test.ts +253 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilRestrictedGapRepro.test.ts +157 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilRotationFixes.test.ts +414 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilTimezone.test.ts +243 -0
- package/Tests/Types/OnCallDutyPolicy/LayerUtilWeekendGapRepro.test.ts +112 -0
- package/Tests/Types/OnCallDutyPolicy/OverrideLensAudit.test.ts +117 -0
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimes.test.ts +8 -6
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimesDefaultDayAudit.test.ts +112 -0
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimesExhaustive.test.ts +821 -0
- package/Tests/Types/OnCallDutyPolicy/RestrictionTimesMutationInvariant.test.ts +886 -0
- package/Tests/Types/OnCallDutyPolicy/UserOverrideUtil.test.ts +255 -0
- package/Tests/Types/OnCallDutyPolicy/UserOverrideUtilExhaustive.test.ts +1126 -0
- package/Types/Date.ts +200 -15
- package/Types/OnCallDutyPolicy/Layer.ts +790 -260
- package/Types/OnCallDutyPolicy/RestrictionTimes.ts +39 -13
- package/Types/OnCallDutyPolicy/UserOverrideUtil.ts +21 -5
- package/UI/Components/Events/RecurringFieldElement.tsx +16 -0
- package/UI/Components/ModelFormModal/ModelFormModal.tsx +8 -0
- package/UI/Components/RadioButtons/BasicRadioButtons.tsx +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeRoleMember.js +1 -1
- package/build/dist/Models/DatabaseModels/IncidentEpisodeRoleMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncidentMember.js +1 -1
- package/build/dist/Models/DatabaseModels/IncidentMember.js.map +1 -1
- package/build/dist/Models/DatabaseModels/IncomingCallPolicy.js +10 -0
- package/build/dist/Models/DatabaseModels/IncomingCallPolicy.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MigrationFailure.js +196 -0
- package/build/dist/Models/DatabaseModels/MigrationFailure.js.map +1 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +52 -2
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js +45 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicySchedule.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js +6 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js +6 -0
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js.map +1 -1
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js +2 -2
- package/build/dist/Models/DatabaseModels/OnCallDutyPolicyUserOverride.js.map +1 -1
- package/build/dist/Server/API/AlertAPI.js +1 -1
- package/build/dist/Server/API/IncidentAPI.js +2 -2
- package/build/dist/Server/API/IncidentEpisodeAPI.js +1 -1
- package/build/dist/Server/API/LlmProviderAPI.js +1 -0
- package/build/dist/Server/API/LlmProviderAPI.js.map +1 -1
- package/build/dist/Server/API/ScheduledMaintenanceAPI.js +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783510935686-FixNotNullForeignKeysOnDelete.js +38 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783510935686-FixNotNullForeignKeysOnDelete.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783515836148-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783515836148-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.js +18 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/PostgresDatabase.js +9 -0
- package/build/dist/Server/Infrastructure/PostgresDatabase.js.map +1 -1
- package/build/dist/Server/Services/AIService.js +53 -2
- package/build/dist/Server/Services/AIService.js.map +1 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js +10 -1
- package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +10 -1
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/IncidentService.js +1 -1
- package/build/dist/Server/Services/IncomingCallPolicyEscalationRuleService.js +55 -2
- package/build/dist/Server/Services/IncomingCallPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/IncomingCallPolicyService.js +40 -0
- package/build/dist/Server/Services/IncomingCallPolicyService.js.map +1 -1
- package/build/dist/Server/Services/Index.js +2 -0
- package/build/dist/Server/Services/Index.js.map +1 -1
- package/build/dist/Server/Services/MigrationFailureService.js +9 -0
- package/build/dist/Server/Services/MigrationFailureService.js.map +1 -0
- package/build/dist/Server/Services/MonitorProbeService.js +33 -7
- package/build/dist/Server/Services/MonitorProbeService.js.map +1 -1
- package/build/dist/Server/Services/MonitorService.js +12 -5
- package/build/dist/Server/Services/MonitorService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js +81 -22
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js +134 -31
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js +21 -13
- package/build/dist/Server/Services/OnCallDutyPolicyEscalationRuleUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js +36 -0
- package/build/dist/Server/Services/OnCallDutyPolicyExecutionLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerService.js +121 -0
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerUserService.js +11 -2
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleLayerUserService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js +409 -36
- package/build/dist/Server/Services/OnCallDutyPolicyScheduleService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyTimeLogService.js +52 -8
- package/build/dist/Server/Services/OnCallDutyPolicyTimeLogService.js.map +1 -1
- package/build/dist/Server/Services/OnCallDutyPolicyUserOverrideService.js +170 -3
- package/build/dist/Server/Services/OnCallDutyPolicyUserOverrideService.js.map +1 -1
- package/build/dist/Server/Services/ProjectCallSMSConfigService.js +72 -0
- package/build/dist/Server/Services/ProjectCallSMSConfigService.js.map +1 -1
- package/build/dist/Server/Services/TeamMemberService.js +6 -0
- package/build/dist/Server/Services/TeamMemberService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +12 -30
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogService.js +75 -0
- package/build/dist/Server/Services/UserOnCallLogService.js.map +1 -1
- package/build/dist/Server/Services/UserOnCallLogTimelineService.js +31 -1
- package/build/dist/Server/Services/UserOnCallLogTimelineService.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryUtil.js +45 -0
- package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
- package/build/dist/Server/Utils/AI/AlertAIContextBuilder.js +6 -1
- package/build/dist/Server/Utils/AI/AlertAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js +13 -2
- package/build/dist/Server/Utils/AI/Chat/ChatAgentRunner.js.map +1 -1
- package/build/dist/Server/Utils/AI/IncidentAIContextBuilder.js +18 -3
- package/build/dist/Server/Utils/AI/IncidentAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js +6 -1
- package/build/dist/Server/Utils/AI/IncidentEpisodeAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.js +12 -2
- package/build/dist/Server/Utils/AI/ScheduledMaintenanceAIContextBuilder.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js +152 -1
- package/build/dist/Server/Utils/AI/Toolbox/IncidentTools.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js +4 -1
- package/build/dist/Server/Utils/AI/Toolbox/Index.js.map +1 -1
- package/build/dist/Server/Utils/AI/Toolbox/RecentChangesTools.js +165 -0
- package/build/dist/Server/Utils/AI/Toolbox/RecentChangesTools.js.map +1 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js +40 -0
- package/build/dist/Server/Utils/AI/Toolbox/Serializer.js.map +1 -1
- package/build/dist/Server/Utils/Database/MigrationFailureLog.js +174 -0
- package/build/dist/Server/Utils/Database/MigrationFailureLog.js.map +1 -0
- package/build/dist/Server/Utils/IncomingCallPhoneNumber.js +30 -0
- package/build/dist/Server/Utils/IncomingCallPhoneNumber.js.map +1 -0
- package/build/dist/Server/Utils/LLM/LLMService.js +81 -5
- package/build/dist/Server/Utils/LLM/LLMService.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/IoTSnapshotScan.js +11 -8
- package/build/dist/Server/Utils/Telemetry/IoTSnapshotScan.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js +11 -8
- package/build/dist/Server/Utils/Telemetry/ProxmoxCephSnapshotScan.js.map +1 -1
- package/build/dist/Types/Date.js +153 -15
- package/build/dist/Types/Date.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/Layer.js +602 -171
- package/build/dist/Types/OnCallDutyPolicy/Layer.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/RestrictionTimes.js +27 -13
- package/build/dist/Types/OnCallDutyPolicy/RestrictionTimes.js.map +1 -1
- package/build/dist/Types/OnCallDutyPolicy/UserOverrideUtil.js +20 -5
- package/build/dist/Types/OnCallDutyPolicy/UserOverrideUtil.js.map +1 -1
- package/build/dist/UI/Components/Events/RecurringFieldElement.js +13 -0
- package/build/dist/UI/Components/Events/RecurringFieldElement.js.map +1 -1
- package/build/dist/UI/Components/ModelFormModal/ModelFormModal.js.map +1 -1
- package/build/dist/UI/Components/RadioButtons/BasicRadioButtons.js +1 -1
- package/build/dist/UI/Components/RadioButtons/BasicRadioButtons.js.map +1 -1
- package/package.json +1 -1
|
@@ -89,6 +89,19 @@ import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
|
89
89
|
tableDescription:
|
|
90
90
|
"Manage incoming call routing policies with escalation rules for on-call teams",
|
|
91
91
|
})
|
|
92
|
+
/*
|
|
93
|
+
* A routing phone number may belong to at most one active policy. The inbound
|
|
94
|
+
* /voice webhook looks up the policy by routingPhoneNumber and assumes a single
|
|
95
|
+
* match, so this uniqueness is enforced at the DB level (partial index in the
|
|
96
|
+
* migration; NULLs are allowed for policies without a number yet).
|
|
97
|
+
*/
|
|
98
|
+
@Index(
|
|
99
|
+
"IDX_INCOMING_CALL_POLICY_ROUTING_PHONE_UNIQUE",
|
|
100
|
+
["routingPhoneNumber"],
|
|
101
|
+
{
|
|
102
|
+
unique: true,
|
|
103
|
+
},
|
|
104
|
+
)
|
|
92
105
|
export default class IncomingCallPolicy extends BaseModel {
|
|
93
106
|
@ColumnAccessControl({
|
|
94
107
|
create: [
|
|
@@ -58,6 +58,7 @@ import BillingPaymentMethods from "./BillingPaymentMethod";
|
|
|
58
58
|
import CallLog from "./CallLog";
|
|
59
59
|
// Date migration
|
|
60
60
|
import DataMigration from "./DataMigration";
|
|
61
|
+
import MigrationFailure from "./MigrationFailure";
|
|
61
62
|
import Domain from "./Domain";
|
|
62
63
|
import EmailLog from "./EmailLog";
|
|
63
64
|
import EmailVerificationToken from "./EmailVerificationToken";
|
|
@@ -650,6 +651,8 @@ const AllModelTypes: Array<{
|
|
|
650
651
|
|
|
651
652
|
DataMigration,
|
|
652
653
|
|
|
654
|
+
MigrationFailure,
|
|
655
|
+
|
|
653
656
|
ShortLink,
|
|
654
657
|
|
|
655
658
|
ScheduledMaintenanceTemplate,
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
2
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
3
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
4
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
5
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
6
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
7
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
8
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
9
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
10
|
+
import { Column, Entity, Index } from "typeorm";
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Persistent log of migrations that FAILED to apply. Neither the TypeORM
|
|
14
|
+
* `migrations` table nor the `DataMigrations` table records failures — they
|
|
15
|
+
* only ever gain a row on SUCCESS — so without this table the admin health
|
|
16
|
+
* page can show that a migration is pending but never why. Each failed attempt
|
|
17
|
+
* appends a row here (name + redacted error + when it ran), which the
|
|
18
|
+
* migration-status endpoint reads back to explain a stuck / behind schema.
|
|
19
|
+
*
|
|
20
|
+
* Access control is empty (root-only): rows are written by the migration
|
|
21
|
+
* runners and read by the master-admin health endpoint via raw/isRoot queries,
|
|
22
|
+
* never by tenant users, so no CRUD API is exposed.
|
|
23
|
+
*/
|
|
24
|
+
@TableAccessControl({
|
|
25
|
+
create: [],
|
|
26
|
+
read: [],
|
|
27
|
+
delete: [],
|
|
28
|
+
update: [],
|
|
29
|
+
})
|
|
30
|
+
@TableMetadata({
|
|
31
|
+
tableName: "MigrationFailure",
|
|
32
|
+
singularName: "Migration Failure",
|
|
33
|
+
pluralName: "Migration Failures",
|
|
34
|
+
icon: IconProp.Database,
|
|
35
|
+
tableDescription:
|
|
36
|
+
"Log of database migrations that failed to apply, with the error and when they were attempted.",
|
|
37
|
+
})
|
|
38
|
+
@Entity({
|
|
39
|
+
name: "MigrationFailure",
|
|
40
|
+
})
|
|
41
|
+
export default class MigrationFailure extends BaseModel {
|
|
42
|
+
@ColumnAccessControl({
|
|
43
|
+
create: [],
|
|
44
|
+
read: [],
|
|
45
|
+
update: [],
|
|
46
|
+
})
|
|
47
|
+
@Index()
|
|
48
|
+
@TableColumn({
|
|
49
|
+
required: true,
|
|
50
|
+
type: TableColumnType.ShortText,
|
|
51
|
+
title: "Migration Name",
|
|
52
|
+
description: "Name of the migration that failed to apply.",
|
|
53
|
+
})
|
|
54
|
+
@Column({
|
|
55
|
+
nullable: false,
|
|
56
|
+
type: ColumnType.ShortText,
|
|
57
|
+
length: ColumnLength.ShortText,
|
|
58
|
+
})
|
|
59
|
+
public migrationName?: string = undefined;
|
|
60
|
+
|
|
61
|
+
@ColumnAccessControl({
|
|
62
|
+
create: [],
|
|
63
|
+
read: [],
|
|
64
|
+
update: [],
|
|
65
|
+
})
|
|
66
|
+
@Index()
|
|
67
|
+
@TableColumn({
|
|
68
|
+
required: true,
|
|
69
|
+
type: TableColumnType.ShortText,
|
|
70
|
+
title: "Migration Type",
|
|
71
|
+
description:
|
|
72
|
+
"Which runner the migration belongs to: 'PostgresSchema' (TypeORM schema migration) or 'DataMigration' (ClickHouse / data backfill).",
|
|
73
|
+
})
|
|
74
|
+
@Column({
|
|
75
|
+
nullable: false,
|
|
76
|
+
type: ColumnType.ShortText,
|
|
77
|
+
length: ColumnLength.ShortText,
|
|
78
|
+
})
|
|
79
|
+
public migrationType?: string = undefined;
|
|
80
|
+
|
|
81
|
+
@ColumnAccessControl({
|
|
82
|
+
create: [],
|
|
83
|
+
read: [],
|
|
84
|
+
update: [],
|
|
85
|
+
})
|
|
86
|
+
@TableColumn({
|
|
87
|
+
required: true,
|
|
88
|
+
type: TableColumnType.VeryLongText,
|
|
89
|
+
title: "Error Message",
|
|
90
|
+
description:
|
|
91
|
+
"The error message from the failed attempt (credentials redacted).",
|
|
92
|
+
})
|
|
93
|
+
@Column({
|
|
94
|
+
nullable: false,
|
|
95
|
+
type: ColumnType.VeryLongText,
|
|
96
|
+
})
|
|
97
|
+
public errorMessage?: string = undefined;
|
|
98
|
+
|
|
99
|
+
@ColumnAccessControl({
|
|
100
|
+
create: [],
|
|
101
|
+
read: [],
|
|
102
|
+
update: [],
|
|
103
|
+
})
|
|
104
|
+
@TableColumn({
|
|
105
|
+
required: false,
|
|
106
|
+
type: TableColumnType.VeryLongText,
|
|
107
|
+
title: "Error Stack",
|
|
108
|
+
description:
|
|
109
|
+
"The stack trace from the failed attempt, if available (credentials redacted).",
|
|
110
|
+
})
|
|
111
|
+
@Column({
|
|
112
|
+
nullable: true,
|
|
113
|
+
type: ColumnType.VeryLongText,
|
|
114
|
+
})
|
|
115
|
+
public errorStack?: string = undefined;
|
|
116
|
+
|
|
117
|
+
@ColumnAccessControl({
|
|
118
|
+
create: [],
|
|
119
|
+
read: [],
|
|
120
|
+
update: [],
|
|
121
|
+
})
|
|
122
|
+
@Index()
|
|
123
|
+
@TableColumn({
|
|
124
|
+
required: true,
|
|
125
|
+
type: TableColumnType.Date,
|
|
126
|
+
title: "Attempted At",
|
|
127
|
+
description: "When this migration was attempted (and failed).",
|
|
128
|
+
})
|
|
129
|
+
@Column({
|
|
130
|
+
nullable: false,
|
|
131
|
+
type: ColumnType.Date,
|
|
132
|
+
})
|
|
133
|
+
public attemptedAt?: Date = undefined;
|
|
134
|
+
|
|
135
|
+
@ColumnAccessControl({
|
|
136
|
+
create: [],
|
|
137
|
+
read: [],
|
|
138
|
+
update: [],
|
|
139
|
+
})
|
|
140
|
+
@TableColumn({
|
|
141
|
+
required: false,
|
|
142
|
+
type: TableColumnType.ShortText,
|
|
143
|
+
title: "Host Name",
|
|
144
|
+
description: "Hostname / pod that ran the failed migration.",
|
|
145
|
+
})
|
|
146
|
+
@Column({
|
|
147
|
+
nullable: true,
|
|
148
|
+
type: ColumnType.ShortText,
|
|
149
|
+
length: ColumnLength.ShortText,
|
|
150
|
+
})
|
|
151
|
+
public hostName?: string = undefined;
|
|
152
|
+
|
|
153
|
+
@ColumnAccessControl({
|
|
154
|
+
create: [],
|
|
155
|
+
read: [],
|
|
156
|
+
update: [],
|
|
157
|
+
})
|
|
158
|
+
@TableColumn({
|
|
159
|
+
required: false,
|
|
160
|
+
type: TableColumnType.ShortText,
|
|
161
|
+
title: "App Version",
|
|
162
|
+
description: "Build / app version that attempted the migration.",
|
|
163
|
+
})
|
|
164
|
+
@Column({
|
|
165
|
+
nullable: true,
|
|
166
|
+
type: ColumnType.ShortText,
|
|
167
|
+
length: ColumnLength.ShortText,
|
|
168
|
+
})
|
|
169
|
+
public appVersion?: string = undefined;
|
|
170
|
+
}
|
|
@@ -1017,7 +1017,16 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
1017
1017
|
Permission.OnCallMember,
|
|
1018
1018
|
Permission.CreateProjectOnCallDutyPolicyExecutionLog,
|
|
1019
1019
|
],
|
|
1020
|
-
read: [
|
|
1020
|
+
read: [
|
|
1021
|
+
Permission.ProjectOwner,
|
|
1022
|
+
Permission.ProjectAdmin,
|
|
1023
|
+
Permission.ProjectMember,
|
|
1024
|
+
Permission.Viewer,
|
|
1025
|
+
Permission.OnCallAdmin,
|
|
1026
|
+
Permission.OnCallMember,
|
|
1027
|
+
Permission.OnCallViewer,
|
|
1028
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
1029
|
+
],
|
|
1021
1030
|
update: [],
|
|
1022
1031
|
})
|
|
1023
1032
|
@Index()
|
|
@@ -1180,7 +1189,16 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
1180
1189
|
Permission.OnCallMember,
|
|
1181
1190
|
Permission.CreateProjectOnCallDutyPolicyExecutionLog,
|
|
1182
1191
|
],
|
|
1183
|
-
read: [
|
|
1192
|
+
read: [
|
|
1193
|
+
Permission.ProjectOwner,
|
|
1194
|
+
Permission.ProjectAdmin,
|
|
1195
|
+
Permission.ProjectMember,
|
|
1196
|
+
Permission.Viewer,
|
|
1197
|
+
Permission.OnCallAdmin,
|
|
1198
|
+
Permission.OnCallMember,
|
|
1199
|
+
Permission.OnCallViewer,
|
|
1200
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
1201
|
+
],
|
|
1184
1202
|
update: [],
|
|
1185
1203
|
})
|
|
1186
1204
|
@Index()
|
|
@@ -1201,6 +1219,37 @@ export default class OnCallDutyPolicyExecutionLog extends BaseModel {
|
|
|
1201
1219
|
})
|
|
1202
1220
|
public onCallPolicyExecutionRepeatCount?: number = undefined;
|
|
1203
1221
|
|
|
1222
|
+
@ColumnAccessControl({
|
|
1223
|
+
create: [],
|
|
1224
|
+
read: [
|
|
1225
|
+
Permission.ProjectOwner,
|
|
1226
|
+
Permission.ProjectAdmin,
|
|
1227
|
+
Permission.ProjectMember,
|
|
1228
|
+
Permission.Viewer,
|
|
1229
|
+
Permission.OnCallAdmin,
|
|
1230
|
+
Permission.OnCallMember,
|
|
1231
|
+
Permission.OnCallViewer,
|
|
1232
|
+
Permission.ReadProjectOnCallDutyPolicyExecutionLog,
|
|
1233
|
+
],
|
|
1234
|
+
update: [],
|
|
1235
|
+
})
|
|
1236
|
+
@TableColumn({
|
|
1237
|
+
type: TableColumnType.Number,
|
|
1238
|
+
required: true,
|
|
1239
|
+
isDefaultValueColumn: true,
|
|
1240
|
+
title: "Schedule Gap Retry Count",
|
|
1241
|
+
description:
|
|
1242
|
+
"How many times the current escalation rule has been re-sampled because its target schedule(s) momentarily had no on-call user.",
|
|
1243
|
+
defaultValue: 0,
|
|
1244
|
+
example: 0,
|
|
1245
|
+
})
|
|
1246
|
+
@Column({
|
|
1247
|
+
type: ColumnType.Number,
|
|
1248
|
+
nullable: false,
|
|
1249
|
+
default: 0,
|
|
1250
|
+
})
|
|
1251
|
+
public scheduleGapRetryCount?: number = undefined;
|
|
1252
|
+
|
|
1204
1253
|
@ColumnAccessControl({
|
|
1205
1254
|
create: [
|
|
1206
1255
|
Permission.ProjectOwner,
|
|
@@ -20,6 +20,7 @@ import TenantColumn from "../../Types/Database/TenantColumn";
|
|
|
20
20
|
import IconProp from "../../Types/Icon/IconProp";
|
|
21
21
|
import ObjectID from "../../Types/ObjectID";
|
|
22
22
|
import Permission from "../../Types/Permission";
|
|
23
|
+
import Timezone from "../../Types/Timezone";
|
|
23
24
|
import {
|
|
24
25
|
Column,
|
|
25
26
|
Entity,
|
|
@@ -319,6 +320,49 @@ export default class OnCallDutyPolicySchedule extends BaseModel {
|
|
|
319
320
|
})
|
|
320
321
|
public description?: string = undefined;
|
|
321
322
|
|
|
323
|
+
@ColumnAccessControl({
|
|
324
|
+
create: [
|
|
325
|
+
Permission.ProjectOwner,
|
|
326
|
+
Permission.ProjectAdmin,
|
|
327
|
+
Permission.ProjectMember,
|
|
328
|
+
Permission.OnCallAdmin,
|
|
329
|
+
Permission.OnCallMember,
|
|
330
|
+
Permission.CreateProjectOnCallDutyPolicySchedule,
|
|
331
|
+
],
|
|
332
|
+
read: [
|
|
333
|
+
Permission.ProjectOwner,
|
|
334
|
+
Permission.ProjectAdmin,
|
|
335
|
+
Permission.ProjectMember,
|
|
336
|
+
Permission.Viewer,
|
|
337
|
+
Permission.OnCallAdmin,
|
|
338
|
+
Permission.OnCallMember,
|
|
339
|
+
Permission.OnCallViewer,
|
|
340
|
+
Permission.ReadProjectOnCallDutyPolicySchedule,
|
|
341
|
+
],
|
|
342
|
+
update: [
|
|
343
|
+
Permission.ProjectOwner,
|
|
344
|
+
Permission.ProjectAdmin,
|
|
345
|
+
Permission.ProjectMember,
|
|
346
|
+
Permission.OnCallAdmin,
|
|
347
|
+
Permission.OnCallMember,
|
|
348
|
+
Permission.EditProjectOnCallDutyPolicySchedule,
|
|
349
|
+
],
|
|
350
|
+
})
|
|
351
|
+
@TableColumn({
|
|
352
|
+
required: false,
|
|
353
|
+
type: TableColumnType.ShortText,
|
|
354
|
+
title: "Timezone",
|
|
355
|
+
description:
|
|
356
|
+
"IANA timezone this schedule's restriction and hand-off wall-clock times are interpreted in. When empty, times are interpreted in the server's local timezone (legacy behavior).",
|
|
357
|
+
example: "America/New_York",
|
|
358
|
+
})
|
|
359
|
+
@Column({
|
|
360
|
+
nullable: true,
|
|
361
|
+
type: ColumnType.ShortText,
|
|
362
|
+
length: ColumnLength.ShortText,
|
|
363
|
+
})
|
|
364
|
+
public timezone?: Timezone = undefined;
|
|
365
|
+
|
|
322
366
|
@Index()
|
|
323
367
|
@ColumnAccessControl({
|
|
324
368
|
create: [
|
|
@@ -52,11 +52,17 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
52
52
|
delete: [
|
|
53
53
|
Permission.ProjectOwner,
|
|
54
54
|
Permission.ProjectAdmin,
|
|
55
|
+
Permission.ProjectMember,
|
|
56
|
+
Permission.OnCallAdmin,
|
|
57
|
+
Permission.OnCallMember,
|
|
55
58
|
Permission.DeleteOnCallDutyPolicyScheduleLayer,
|
|
56
59
|
],
|
|
57
60
|
update: [
|
|
58
61
|
Permission.ProjectOwner,
|
|
59
62
|
Permission.ProjectAdmin,
|
|
63
|
+
Permission.ProjectMember,
|
|
64
|
+
Permission.OnCallAdmin,
|
|
65
|
+
Permission.OnCallMember,
|
|
60
66
|
Permission.EditOnCallDutyPolicyScheduleLayer,
|
|
61
67
|
],
|
|
62
68
|
})
|
|
@@ -50,11 +50,17 @@ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
|
50
50
|
delete: [
|
|
51
51
|
Permission.ProjectOwner,
|
|
52
52
|
Permission.ProjectAdmin,
|
|
53
|
+
Permission.ProjectMember,
|
|
54
|
+
Permission.OnCallAdmin,
|
|
55
|
+
Permission.OnCallMember,
|
|
53
56
|
Permission.DeleteOnCallDutyPolicyScheduleLayer,
|
|
54
57
|
],
|
|
55
58
|
update: [
|
|
56
59
|
Permission.ProjectOwner,
|
|
57
60
|
Permission.ProjectAdmin,
|
|
61
|
+
Permission.ProjectMember,
|
|
62
|
+
Permission.OnCallAdmin,
|
|
63
|
+
Permission.OnCallMember,
|
|
58
64
|
Permission.EditOnCallDutyPolicyScheduleLayer,
|
|
59
65
|
],
|
|
60
66
|
})
|
|
@@ -357,7 +357,7 @@ export default class OnCallDutyPolicyUserOverride extends BaseModel {
|
|
|
357
357
|
{
|
|
358
358
|
eager: false,
|
|
359
359
|
nullable: true,
|
|
360
|
-
onDelete: "
|
|
360
|
+
onDelete: "CASCADE",
|
|
361
361
|
orphanedRowAction: "nullify",
|
|
362
362
|
},
|
|
363
363
|
)
|
|
@@ -435,7 +435,7 @@ export default class OnCallDutyPolicyUserOverride extends BaseModel {
|
|
|
435
435
|
{
|
|
436
436
|
eager: false,
|
|
437
437
|
nullable: true,
|
|
438
|
-
onDelete: "
|
|
438
|
+
onDelete: "CASCADE",
|
|
439
439
|
orphanedRowAction: "nullify",
|
|
440
440
|
},
|
|
441
441
|
)
|
package/Server/API/AlertAPI.ts
CHANGED
|
@@ -230,7 +230,7 @@ export default class IncidentAPI extends BaseAPI<
|
|
|
230
230
|
incidentId: incidentId,
|
|
231
231
|
messages: aiContext.messages,
|
|
232
232
|
maxTokens: 8192,
|
|
233
|
-
temperature: 0.
|
|
233
|
+
temperature: 0.2,
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
if (props.userId) {
|
|
@@ -347,7 +347,7 @@ export default class IncidentAPI extends BaseAPI<
|
|
|
347
347
|
incidentId: incidentId,
|
|
348
348
|
messages: aiContext.messages,
|
|
349
349
|
maxTokens: 4096,
|
|
350
|
-
temperature: 0.
|
|
350
|
+
temperature: 0.2,
|
|
351
351
|
};
|
|
352
352
|
|
|
353
353
|
if (props.userId) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddIncomingCallPolicyRoutingPhoneNumberUnique1783470000000
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddIncomingCallPolicyRoutingPhoneNumberUnique1783470000000";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
/*
|
|
10
|
+
* Enforce that a routing phone number belongs to at most one policy. The
|
|
11
|
+
* inbound /voice webhook resolves the policy by routingPhoneNumber and
|
|
12
|
+
* assumes a single match. Partial index so policies without a number (NULL)
|
|
13
|
+
* are unconstrained and soft-deleted rows never collide.
|
|
14
|
+
*/
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`CREATE UNIQUE INDEX "IDX_INCOMING_CALL_POLICY_ROUTING_PHONE_UNIQUE" ON "IncomingCallPolicy" ("routingPhoneNumber") WHERE ("deletedAt" IS NULL AND "routingPhoneNumber" IS NOT NULL)`,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`DROP INDEX "public"."IDX_INCOMING_CALL_POLICY_ROUTING_PHONE_UNIQUE"`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* These foreign keys previously used `ON DELETE SET NULL` even though their
|
|
5
|
+
* referencing columns are `NOT NULL`. Deleting the referenced row (e.g. a User
|
|
6
|
+
* or an IncidentRole) therefore tried to set the column to NULL and failed with
|
|
7
|
+
* a not-null constraint violation. Since each of these columns is required, the
|
|
8
|
+
* dependent row is meaningless without its parent, so the correct behavior is
|
|
9
|
+
* `ON DELETE CASCADE`.
|
|
10
|
+
*/
|
|
11
|
+
export class FixNotNullForeignKeysOnDelete1783510935686
|
|
12
|
+
implements MigrationInterface
|
|
13
|
+
{
|
|
14
|
+
public name = "FixNotNullForeignKeysOnDelete1783510935686";
|
|
15
|
+
|
|
16
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
17
|
+
await queryRunner.query(
|
|
18
|
+
`ALTER TABLE "IncidentMember" DROP CONSTRAINT "FK_6e8334ec5b25d596548c88d0832"`,
|
|
19
|
+
);
|
|
20
|
+
await queryRunner.query(
|
|
21
|
+
`ALTER TABLE "OnCallDutyPolicyTimeLog" DROP CONSTRAINT "FK_43da7ffeee531e9452d36a89ba5"`,
|
|
22
|
+
);
|
|
23
|
+
await queryRunner.query(
|
|
24
|
+
`ALTER TABLE "IncidentEpisodeRoleMember" DROP CONSTRAINT "FK_08c8933e37d14069c0d18b34f14"`,
|
|
25
|
+
);
|
|
26
|
+
await queryRunner.query(
|
|
27
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" DROP CONSTRAINT "FK_4b3f696aaaf327b245ebeb3d146"`,
|
|
28
|
+
);
|
|
29
|
+
await queryRunner.query(
|
|
30
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" DROP CONSTRAINT "FK_8771068ec4c16763a7ff796895d"`,
|
|
31
|
+
);
|
|
32
|
+
await queryRunner.query(
|
|
33
|
+
`ALTER TABLE "IncidentMember" ADD CONSTRAINT "FK_6e8334ec5b25d596548c88d0832" FOREIGN KEY ("incidentRoleId") REFERENCES "IncidentRole"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
34
|
+
);
|
|
35
|
+
await queryRunner.query(
|
|
36
|
+
`ALTER TABLE "OnCallDutyPolicyTimeLog" ADD CONSTRAINT "FK_43da7ffeee531e9452d36a89ba5" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
37
|
+
);
|
|
38
|
+
await queryRunner.query(
|
|
39
|
+
`ALTER TABLE "IncidentEpisodeRoleMember" ADD CONSTRAINT "FK_08c8933e37d14069c0d18b34f14" FOREIGN KEY ("incidentRoleId") REFERENCES "IncidentRole"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
40
|
+
);
|
|
41
|
+
await queryRunner.query(
|
|
42
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" ADD CONSTRAINT "FK_4b3f696aaaf327b245ebeb3d146" FOREIGN KEY ("overrideUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
43
|
+
);
|
|
44
|
+
await queryRunner.query(
|
|
45
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" ADD CONSTRAINT "FK_8771068ec4c16763a7ff796895d" FOREIGN KEY ("routeAlertsToUserId") REFERENCES "User"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
50
|
+
await queryRunner.query(
|
|
51
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" DROP CONSTRAINT "FK_8771068ec4c16763a7ff796895d"`,
|
|
52
|
+
);
|
|
53
|
+
await queryRunner.query(
|
|
54
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" DROP CONSTRAINT "FK_4b3f696aaaf327b245ebeb3d146"`,
|
|
55
|
+
);
|
|
56
|
+
await queryRunner.query(
|
|
57
|
+
`ALTER TABLE "IncidentEpisodeRoleMember" DROP CONSTRAINT "FK_08c8933e37d14069c0d18b34f14"`,
|
|
58
|
+
);
|
|
59
|
+
await queryRunner.query(
|
|
60
|
+
`ALTER TABLE "OnCallDutyPolicyTimeLog" DROP CONSTRAINT "FK_43da7ffeee531e9452d36a89ba5"`,
|
|
61
|
+
);
|
|
62
|
+
await queryRunner.query(
|
|
63
|
+
`ALTER TABLE "IncidentMember" DROP CONSTRAINT "FK_6e8334ec5b25d596548c88d0832"`,
|
|
64
|
+
);
|
|
65
|
+
await queryRunner.query(
|
|
66
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" ADD CONSTRAINT "FK_8771068ec4c16763a7ff796895d" FOREIGN KEY ("routeAlertsToUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
67
|
+
);
|
|
68
|
+
await queryRunner.query(
|
|
69
|
+
`ALTER TABLE "OnCallDutyPolicyUserOverride" ADD CONSTRAINT "FK_4b3f696aaaf327b245ebeb3d146" FOREIGN KEY ("overrideUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
70
|
+
);
|
|
71
|
+
await queryRunner.query(
|
|
72
|
+
`ALTER TABLE "IncidentEpisodeRoleMember" ADD CONSTRAINT "FK_08c8933e37d14069c0d18b34f14" FOREIGN KEY ("incidentRoleId") REFERENCES "IncidentRole"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
73
|
+
);
|
|
74
|
+
await queryRunner.query(
|
|
75
|
+
`ALTER TABLE "OnCallDutyPolicyTimeLog" ADD CONSTRAINT "FK_43da7ffeee531e9452d36a89ba5" FOREIGN KEY ("userId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
76
|
+
);
|
|
77
|
+
await queryRunner.query(
|
|
78
|
+
`ALTER TABLE "IncidentMember" ADD CONSTRAINT "FK_6e8334ec5b25d596548c88d0832" FOREIGN KEY ("incidentRoleId") REFERENCES "IncidentRole"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1783515836148 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1783515836148";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
// HIGH-5: schedule timezone (nullable => existing schedules keep legacy server-local behavior).
|
|
8
|
+
await queryRunner.query(
|
|
9
|
+
`ALTER TABLE "OnCallDutyPolicySchedule" ADD "timezone" character varying(100)`,
|
|
10
|
+
);
|
|
11
|
+
// M-5: bounded retry counter for escalation rules that momentarily resolve to no on-call user.
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`ALTER TABLE "OnCallDutyPolicyExecutionLog" ADD "scheduleGapRetryCount" integer NOT NULL DEFAULT '0'`,
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`ALTER TABLE "OnCallDutyPolicyExecutionLog" DROP COLUMN "scheduleGapRetryCount"`,
|
|
20
|
+
);
|
|
21
|
+
await queryRunner.query(
|
|
22
|
+
`ALTER TABLE "OnCallDutyPolicySchedule" DROP COLUMN "timezone"`,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
package/Server/Infrastructure/Postgres/SchemaMigrations/1783523076215-AddMigrationFailureTable.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class AddMigrationFailureTable1783523076215
|
|
4
|
+
implements MigrationInterface
|
|
5
|
+
{
|
|
6
|
+
public name = "AddMigrationFailureTable1783523076215";
|
|
7
|
+
|
|
8
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
9
|
+
await queryRunner.query(
|
|
10
|
+
`CREATE TABLE "MigrationFailure" ("_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, "migrationName" character varying(100) NOT NULL, "migrationType" character varying(100) NOT NULL, "errorMessage" text NOT NULL, "errorStack" text, "attemptedAt" TIMESTAMP WITH TIME ZONE NOT NULL, "hostName" character varying(100), "appVersion" character varying(100), CONSTRAINT "PK_db298508bb9e7064755c660eb8b" PRIMARY KEY ("_id"))`,
|
|
11
|
+
);
|
|
12
|
+
await queryRunner.query(
|
|
13
|
+
`CREATE INDEX "IDX_afd3cf5c9703ef3cd3f74bcecf" ON "MigrationFailure" ("migrationName") `,
|
|
14
|
+
);
|
|
15
|
+
await queryRunner.query(
|
|
16
|
+
`CREATE INDEX "IDX_0e4fbfab7ec24121ac4fc66d64" ON "MigrationFailure" ("migrationType") `,
|
|
17
|
+
);
|
|
18
|
+
await queryRunner.query(
|
|
19
|
+
`CREATE INDEX "IDX_d0f64f28973facc22ab17764e4" ON "MigrationFailure" ("attemptedAt") `,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
24
|
+
await queryRunner.query(
|
|
25
|
+
`DROP INDEX "public"."IDX_d0f64f28973facc22ab17764e4"`,
|
|
26
|
+
);
|
|
27
|
+
await queryRunner.query(
|
|
28
|
+
`DROP INDEX "public"."IDX_0e4fbfab7ec24121ac4fc66d64"`,
|
|
29
|
+
);
|
|
30
|
+
await queryRunner.query(
|
|
31
|
+
`DROP INDEX "public"."IDX_afd3cf5c9703ef3cd3f74bcecf"`,
|
|
32
|
+
);
|
|
33
|
+
await queryRunner.query(`DROP TABLE "MigrationFailure"`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -413,6 +413,10 @@ import { AddAIChatModels1783363279075 } from "./1783363279075-AddAIChatModels";
|
|
|
413
413
|
import { AddLlmProviderToAIConversation1783443471795 } from "./1783443471795-AddLlmProviderToAIConversation";
|
|
414
414
|
import { AddAIChatWriteActionsAndWidgets1783453297388 } from "./1783453297388-AddAIChatWriteActionsAndWidgets";
|
|
415
415
|
import { MigrationName1783461767405 } from "./1783461767405-MigrationName";
|
|
416
|
+
import { AddIncomingCallPolicyRoutingPhoneNumberUnique1783470000000 } from "./1783470000000-AddIncomingCallPolicyRoutingPhoneNumberUnique";
|
|
417
|
+
import { FixNotNullForeignKeysOnDelete1783510935686 } from "./1783510935686-FixNotNullForeignKeysOnDelete";
|
|
418
|
+
import { MigrationName1783515836148 } from "./1783515836148-MigrationName";
|
|
419
|
+
import { AddMigrationFailureTable1783523076215 } from "./1783523076215-AddMigrationFailureTable";
|
|
416
420
|
|
|
417
421
|
export default [
|
|
418
422
|
InitialMigration,
|
|
@@ -830,4 +834,8 @@ export default [
|
|
|
830
834
|
AddLlmProviderToAIConversation1783443471795,
|
|
831
835
|
AddAIChatWriteActionsAndWidgets1783453297388,
|
|
832
836
|
MigrationName1783461767405,
|
|
837
|
+
AddIncomingCallPolicyRoutingPhoneNumberUnique1783470000000,
|
|
838
|
+
FixNotNullForeignKeysOnDelete1783510935686,
|
|
839
|
+
MigrationName1783515836148,
|
|
840
|
+
AddMigrationFailureTable1783523076215,
|
|
833
841
|
];
|