Files
bitcoin_monitor/monitor/migrations/0004_notificationpreference_emailnotification.py
2026-01-16 22:20:18 +03:00

50 lines
2.6 KiB
Python

# Generated by Django 6.0 on 2025-12-09 22:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('monitor', '0003_systemstatus'),
]
operations = [
migrations.CreateModel(
name='NotificationPreference',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email_address', models.EmailField(max_length=254, unique=True)),
('receive_event_alerts', models.BooleanField(default=True, help_text='Receive immediate alerts for threshold events')),
('receive_system_alerts', models.BooleanField(default=True, help_text='Receive alerts for system failures and issues')),
('receive_daily_digest', models.BooleanField(default=True, help_text='Receive daily summary email at 8 AM')),
('is_active', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='EmailNotification',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('recipient', models.EmailField(max_length=254)),
('subject', models.CharField(max_length=255)),
('notification_type', models.CharField(choices=[('event', 'Event Alert'), ('system', 'System Alert'), ('digest', 'Daily Digest'), ('test', 'Test Email')], max_length=20)),
('status', models.CharField(choices=[('pending', 'Pending'), ('sent', 'Sent'), ('failed', 'Failed'), ('retrying', 'Retrying')], default='pending', max_length=20)),
('content_html', models.TextField(blank=True)),
('content_text', models.TextField(blank=True)),
('error_message', models.TextField(blank=True)),
('sent_at', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('retry_count', models.IntegerField(default=0)),
],
options={
'ordering': ['-created_at'],
'indexes': [models.Index(fields=['recipient', 'created_at'], name='monitor_ema_recipie_afeb01_idx'), models.Index(fields=['notification_type', 'status'], name='monitor_ema_notific_6e50b6_idx')],
},
),
]