first commit
This commit is contained in:
27
monitor/migrations/0001_initial.py
Normal file
27
monitor/migrations/0001_initial.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# Generated by Django 6.0 on 2025-12-09 20:45
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='BitcoinPrice',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('price_usd', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('volume', models.DecimalField(blank=True, decimal_places=2, max_digits=30, null=True)),
|
||||
('market_cap', models.DecimalField(blank=True, decimal_places=2, max_digits=30, null=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-timestamp'],
|
||||
},
|
||||
),
|
||||
]
|
||||
37
monitor/migrations/0002_marketanalysis.py
Normal file
37
monitor/migrations/0002_marketanalysis.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Generated by Django 6.0 on 2025-12-09 21:03
|
||||
|
||||
import django.core.validators
|
||||
from decimal import Decimal
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('monitor', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='MarketAnalysis',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('period', models.CharField(choices=[('hourly', 'Hourly'), ('daily', 'Daily'), ('weekly', 'Weekly'), ('yearly', 'Yearly')], default='hourly', max_length=10)),
|
||||
('current_price', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('average_price', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('min_price', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('max_price', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('status', models.CharField(choices=[('dip', 'Dip'), ('peak', 'Peak'), ('neutral', 'Neutral')], default='neutral', max_length=10)),
|
||||
('threshold_percent', models.DecimalField(decimal_places=2, default=15.0, max_digits=5, validators=[django.core.validators.MinValueValidator(Decimal('0.01')), django.core.validators.MaxValueValidator(Decimal('100'))])),
|
||||
('lower_threshold', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('upper_threshold', models.DecimalField(decimal_places=2, max_digits=20)),
|
||||
('is_event', models.BooleanField(default=False)),
|
||||
('event_type', models.CharField(blank=True, choices=[('dip_below', 'Dip Below Threshold'), ('rise_above', 'Rise Above Threshold'), ('neutralized', 'Neutralized')], max_length=20)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Market Analyses',
|
||||
'ordering': ['-timestamp'],
|
||||
},
|
||||
),
|
||||
]
|
||||
30
monitor/migrations/0003_systemstatus.py
Normal file
30
monitor/migrations/0003_systemstatus.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# Generated by Django 6.0 on 2025-12-09 21:49
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('monitor', '0002_marketanalysis'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='SystemStatus',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('last_hourly_update', models.DateTimeField(blank=True, null=True)),
|
||||
('last_successful_fetch', models.DateTimeField(blank=True, null=True)),
|
||||
('current_price', models.DecimalField(blank=True, decimal_places=2, max_digits=20, null=True)),
|
||||
('last_error', models.TextField(blank=True)),
|
||||
('is_stale', models.BooleanField(default=True)),
|
||||
('is_healthy', models.BooleanField(default=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'System Statuses',
|
||||
'ordering': ['-timestamp'],
|
||||
},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,49 @@
|
||||
# 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')],
|
||||
},
|
||||
),
|
||||
]
|
||||
0
monitor/migrations/__init__.py
Normal file
0
monitor/migrations/__init__.py
Normal file
Reference in New Issue
Block a user