Files
Iliyan Angelov 6b247e5b9f Updates
2025-09-19 11:58:53 +03:00

262 lines
20 KiB
Python

# Generated by Django 5.2.6 on 2025-09-18 16:26
import django.db.models.deletion
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('automation_orchestration', '0002_autoremediationexecution_sla_instance_and_more'),
('incident_intelligence', '0004_incident_oncall_assignment_incident_sla_override_and_more'),
('security', '0002_user_emergency_contact_user_oncall_preferences_and_more'),
('sla_oncall', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ConferenceBridge',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=200)),
('description', models.TextField(blank=True, null=True)),
('bridge_type', models.CharField(choices=[('ZOOM', 'Zoom'), ('TEAMS', 'Microsoft Teams'), ('WEBEX', 'Cisco Webex'), ('GOTO_MEETING', 'GoTo Meeting'), ('CUSTOM', 'Custom Bridge')], max_length=20)),
('status', models.CharField(choices=[('SCHEDULED', 'Scheduled'), ('ACTIVE', 'Active'), ('ENDED', 'Ended'), ('CANCELLED', 'Cancelled')], default='SCHEDULED', max_length=20)),
('meeting_id', models.CharField(blank=True, help_text='External meeting ID', max_length=255, null=True)),
('meeting_url', models.URLField(blank=True, help_text='Meeting URL', null=True)),
('dial_in_number', models.CharField(blank=True, help_text='Dial-in phone number', max_length=50, null=True)),
('access_code', models.CharField(blank=True, help_text='Access code for dial-in', max_length=20, null=True)),
('scheduled_start', models.DateTimeField(help_text='Scheduled start time')),
('scheduled_end', models.DateTimeField(help_text='Scheduled end time')),
('actual_start', models.DateTimeField(blank=True, null=True)),
('actual_end', models.DateTimeField(blank=True, null=True)),
('max_participants', models.PositiveIntegerField(default=50)),
('recording_enabled', models.BooleanField(default=False)),
('recording_url', models.URLField(blank=True, help_text='URL to recorded meeting', null=True)),
('transcription_enabled', models.BooleanField(default=False)),
('transcription_url', models.URLField(blank=True, help_text='URL to meeting transcription', null=True)),
('integration_config', models.JSONField(default=dict, help_text='Configuration for external bridge integration')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('active_participants', models.ManyToManyField(blank=True, help_text='Users currently in the conference', related_name='active_conferences', to=settings.AUTH_USER_MODEL)),
('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_conferences', to=settings.AUTH_USER_MODEL)),
('incident', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='conference_bridges', to='incident_intelligence.incident')),
('invited_participants', models.ManyToManyField(blank=True, help_text='Users invited to the conference', related_name='invited_conferences', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-scheduled_start'],
},
),
migrations.CreateModel(
name='IncidentCommandRole',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('role_type', models.CharField(choices=[('INCIDENT_COMMANDER', 'Incident Commander'), ('SCRIBE', 'Scribe'), ('COMMS_LEAD', 'Communications Lead'), ('TECHNICAL_LEAD', 'Technical Lead'), ('BUSINESS_LEAD', 'Business Lead'), ('EXTERNAL_LIAISON', 'External Liaison'), ('OBSERVER', 'Observer')], max_length=30)),
('status', models.CharField(choices=[('ACTIVE', 'Active'), ('INACTIVE', 'Inactive'), ('REASSIGNED', 'Reassigned')], default='ACTIVE', max_length=20)),
('responsibilities', models.JSONField(default=list, help_text='List of responsibilities for this role')),
('decision_authority', models.JSONField(default=list, help_text='Areas where this role has decision authority')),
('assigned_at', models.DateTimeField(auto_now_add=True)),
('reassigned_at', models.DateTimeField(blank=True, null=True)),
('assignment_notes', models.TextField(blank=True, null=True)),
('decisions_made', models.PositiveIntegerField(default=0)),
('communications_sent', models.PositiveIntegerField(default=0)),
('last_activity', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('assigned_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='assigned_command_roles', to=settings.AUTH_USER_MODEL)),
('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_command_roles', to=settings.AUTH_USER_MODEL)),
('incident', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='command_roles', to='incident_intelligence.incident')),
('reassigned_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='reassigned_command_roles', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-assigned_at'],
},
),
migrations.CreateModel(
name='WarRoom',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('name', models.CharField(max_length=200)),
('description', models.TextField(blank=True, null=True)),
('status', models.CharField(choices=[('ACTIVE', 'Active'), ('ARCHIVED', 'Archived'), ('CLOSED', 'Closed')], default='ACTIVE', max_length=20)),
('privacy_level', models.CharField(choices=[('PUBLIC', 'Public'), ('PRIVATE', 'Private'), ('RESTRICTED', 'Restricted')], default='PRIVATE', max_length=20)),
('slack_channel_id', models.CharField(blank=True, help_text='Slack channel ID', max_length=100, null=True)),
('teams_channel_id', models.CharField(blank=True, help_text='Teams channel ID', max_length=100, null=True)),
('discord_channel_id', models.CharField(blank=True, help_text='Discord channel ID', max_length=100, null=True)),
('message_count', models.PositiveIntegerField(default=0)),
('last_activity', models.DateTimeField(blank=True, null=True)),
('active_participants', models.PositiveIntegerField(default=0)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('archived_at', models.DateTimeField(blank=True, null=True)),
('allowed_users', models.ManyToManyField(blank=True, help_text='Users with access to this war room', related_name='accessible_war_rooms', to=settings.AUTH_USER_MODEL)),
('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_war_rooms', to=settings.AUTH_USER_MODEL)),
('incident', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='war_rooms', to='incident_intelligence.incident')),
('required_clearance_level', models.ForeignKey(blank=True, help_text='Required clearance level for access', null=True, on_delete=django.db.models.deletion.SET_NULL, to='security.dataclassification')),
],
options={
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='TimelineEvent',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('event_type', models.CharField(choices=[('INCIDENT_CREATED', 'Incident Created'), ('INCIDENT_UPDATED', 'Incident Updated'), ('ASSIGNMENT_CHANGED', 'Assignment Changed'), ('STATUS_CHANGED', 'Status Changed'), ('SEVERITY_CHANGED', 'Severity Changed'), ('COMMENT_ADDED', 'Comment Added'), ('RUNBOOK_EXECUTED', 'Runbook Executed'), ('AUTO_REMEDIATION_ATTEMPTED', 'Auto-remediation Attempted'), ('SLA_BREACHED', 'SLA Breached'), ('ESCALATION_TRIGGERED', 'Escalation Triggered'), ('WAR_ROOM_CREATED', 'War Room Created'), ('CONFERENCE_STARTED', 'Conference Started'), ('COMMAND_ROLE_ASSIGNED', 'Command Role Assigned'), ('DECISION_MADE', 'Decision Made'), ('COMMUNICATION_SENT', 'Communication Sent'), ('EXTERNAL_INTEGRATION', 'External Integration'), ('MANUAL_EVENT', 'Manual Event')], max_length=30)),
('title', models.CharField(max_length=200)),
('description', models.TextField()),
('source_type', models.CharField(choices=[('SYSTEM', 'System Generated'), ('USER', 'User Created'), ('INTEGRATION', 'External Integration'), ('AUTOMATION', 'Automation')], default='SYSTEM', max_length=20)),
('event_time', models.DateTimeField(help_text='When the event occurred')),
('created_at', models.DateTimeField(auto_now_add=True)),
('event_data', models.JSONField(default=dict, help_text='Additional data related to the event')),
('tags', models.JSONField(default=list, help_text='Tags for categorization and filtering')),
('is_critical_event', models.BooleanField(default=False, help_text='Whether this event is critical for postmortem analysis')),
('postmortem_notes', models.TextField(blank=True, help_text='Additional notes added during postmortem', null=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_timeline_events', to=settings.AUTH_USER_MODEL)),
('incident', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='timeline_events', to='incident_intelligence.incident')),
('related_auto_remediation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='automation_orchestration.autoremediationexecution')),
('related_command_role', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='collaboration_war_rooms.incidentcommandrole')),
('related_conference', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='collaboration_war_rooms.conferencebridge')),
('related_escalation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='sla_oncall.escalationinstance')),
('related_runbook_execution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='automation_orchestration.runbookexecution')),
('related_sla_instance', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='sla_oncall.slainstance')),
('related_user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to=settings.AUTH_USER_MODEL)),
('related_war_room', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='timeline_events', to='collaboration_war_rooms.warroom')),
],
options={
'ordering': ['event_time', 'created_at'],
},
),
migrations.AddField(
model_name='incidentcommandrole',
name='war_room',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='command_roles', to='collaboration_war_rooms.warroom'),
),
migrations.AddField(
model_name='conferencebridge',
name='war_room',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='conference_bridges', to='collaboration_war_rooms.warroom'),
),
migrations.CreateModel(
name='WarRoomMessage',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('message_type', models.CharField(choices=[('TEXT', 'Text Message'), ('SYSTEM', 'System Message'), ('COMMAND', 'Command Message'), ('ALERT', 'Alert Message'), ('UPDATE', 'Status Update')], default='TEXT', max_length=20)),
('content', models.TextField()),
('sender_name', models.CharField(help_text='Display name of sender', max_length=100)),
('is_edited', models.BooleanField(default=False)),
('edited_at', models.DateTimeField(blank=True, null=True)),
('external_message_id', models.CharField(blank=True, help_text='ID in external system (Slack, Teams, etc.)', max_length=255, null=True)),
('external_data', models.JSONField(default=dict, help_text='Additional data from external system')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('reply_to', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='replies', to='collaboration_war_rooms.warroommessage')),
('sender', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='war_room_messages', to=settings.AUTH_USER_MODEL)),
('war_room', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='collaboration_war_rooms.warroom')),
],
options={
'ordering': ['created_at'],
},
),
migrations.CreateModel(
name='IncidentDecision',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
('decision_type', models.CharField(choices=[('TECHNICAL', 'Technical Decision'), ('BUSINESS', 'Business Decision'), ('COMMUNICATION', 'Communication Decision'), ('ESCALATION', 'Escalation Decision'), ('RESOURCE', 'Resource Allocation'), ('TIMELINE', 'Timeline Decision')], max_length=20)),
('title', models.CharField(max_length=200)),
('description', models.TextField()),
('rationale', models.TextField(help_text='Reasoning behind the decision')),
('status', models.CharField(choices=[('PENDING', 'Pending'), ('APPROVED', 'Approved'), ('REJECTED', 'Rejected'), ('IMPLEMENTED', 'Implemented')], default='PENDING', max_length=20)),
('requires_approval', models.BooleanField(default=False)),
('approved_at', models.DateTimeField(blank=True, null=True)),
('implementation_notes', models.TextField(blank=True, null=True)),
('implemented_at', models.DateTimeField(blank=True, null=True)),
('impact_assessment', models.TextField(blank=True, null=True)),
('success_metrics', models.JSONField(default=list, help_text='Metrics to measure decision success')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_decisions', to=settings.AUTH_USER_MODEL)),
('command_role', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='decisions', to='collaboration_war_rooms.incidentcommandrole')),
('implemented_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='implemented_decisions', to=settings.AUTH_USER_MODEL)),
('incident', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='decisions', to='incident_intelligence.incident')),
],
options={
'ordering': ['-created_at'],
'indexes': [models.Index(fields=['incident', 'status'], name='collaborati_inciden_4f34eb_idx'), models.Index(fields=['command_role', 'decision_type'], name='collaborati_command_81be71_idx'), models.Index(fields=['status', 'created_at'], name='collaborati_status_3f5734_idx')],
},
),
migrations.AddIndex(
model_name='warroom',
index=models.Index(fields=['incident', 'status'], name='collaborati_inciden_bd58db_idx'),
),
migrations.AddIndex(
model_name='warroom',
index=models.Index(fields=['status', 'privacy_level'], name='collaborati_status_649ccc_idx'),
),
migrations.AddIndex(
model_name='warroom',
index=models.Index(fields=['created_at'], name='collaborati_created_e3a240_idx'),
),
migrations.AddIndex(
model_name='timelineevent',
index=models.Index(fields=['incident', 'event_time'], name='collaborati_inciden_3a611f_idx'),
),
migrations.AddIndex(
model_name='timelineevent',
index=models.Index(fields=['event_type', 'event_time'], name='collaborati_event_t_d2100a_idx'),
),
migrations.AddIndex(
model_name='timelineevent',
index=models.Index(fields=['source_type', 'event_time'], name='collaborati_source__0c3cc4_idx'),
),
migrations.AddIndex(
model_name='timelineevent',
index=models.Index(fields=['is_critical_event', 'event_time'], name='collaborati_is_crit_28e610_idx'),
),
migrations.AddIndex(
model_name='incidentcommandrole',
index=models.Index(fields=['incident', 'role_type'], name='collaborati_inciden_7c5ba6_idx'),
),
migrations.AddIndex(
model_name='incidentcommandrole',
index=models.Index(fields=['assigned_user', 'status'], name='collaborati_assigne_e33d48_idx'),
),
migrations.AddIndex(
model_name='incidentcommandrole',
index=models.Index(fields=['status', 'assigned_at'], name='collaborati_status_b2ec4b_idx'),
),
migrations.AlterUniqueTogether(
name='incidentcommandrole',
unique_together={('incident', 'role_type', 'assigned_user')},
),
migrations.AddIndex(
model_name='conferencebridge',
index=models.Index(fields=['incident', 'status'], name='collaborati_inciden_4be2c2_idx'),
),
migrations.AddIndex(
model_name='conferencebridge',
index=models.Index(fields=['bridge_type', 'status'], name='collaborati_bridge__44a9ea_idx'),
),
migrations.AddIndex(
model_name='conferencebridge',
index=models.Index(fields=['scheduled_start'], name='collaborati_schedul_a93d14_idx'),
),
migrations.AddIndex(
model_name='warroommessage',
index=models.Index(fields=['war_room', 'created_at'], name='collaborati_war_roo_6320f9_idx'),
),
migrations.AddIndex(
model_name='warroommessage',
index=models.Index(fields=['sender', 'created_at'], name='collaborati_sender__f499b1_idx'),
),
migrations.AddIndex(
model_name='warroommessage',
index=models.Index(fields=['message_type', 'created_at'], name='collaborati_message_a29f3d_idx'),
),
]