feat(migrations): Initialize database schema for messaging
This commit introduces the initial set of database migrations required for setting up the foundational models of the messaging system within the application. These models include `GatewayUser`, `GatewayUserSetting`, `Notification`, and various scheduling entities to manage notification delivery timings. It lays the groundwork for linking users to their gateway preferences, storing customizable settings per gateway-user pair, and managing notifications with flexible scheduling options. This schema setup is crucial for supporting a dynamic and configurable messaging system, enabling efficient notification management and dispatching based on user preferences and predefined schedules. By establishing a robust database schema upfront, we ensure that the application can scale effectively, facilitating ease of maintenance and future enhancements. This migration caters to the need for a cohesive and flexible data model to represent users, their notification preferences, and the logistics of notification dispatching and scheduling within the system.
This commit is contained in:
parent
f7baae834a
commit
5d10e28d69
2 changed files with 70 additions and 0 deletions
70
msgio/migrations/0001_initial.py
Normal file
70
msgio/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
# Generated by Django 5.0.6 on 2024-05-17 11:30
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GatewayUser',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('gateway', models.CharField(max_length=64)),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='GatewayUserSetting',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('key', models.CharField(max_length=64)),
|
||||||
|
('value', models.CharField(max_length=256)),
|
||||||
|
('gatewayuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgio.gatewayuser')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Notification',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('content', models.TextField()),
|
||||||
|
('app', models.CharField(blank=True, max_length=64, null=True)),
|
||||||
|
('data', models.CharField(blank=True, max_length=128, null=True)),
|
||||||
|
('recipient', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationDailySchedule',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('time', models.TimeField()),
|
||||||
|
('last_sent', models.DateField(blank=True, null=True)),
|
||||||
|
('notification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgio.notification')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationDatetimeSchedule',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('datetime', models.DateTimeField()),
|
||||||
|
('sent', models.BooleanField(default=False)),
|
||||||
|
('notification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgio.notification')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='NotificationDispatcher',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('dispatcher', models.CharField(max_length=64)),
|
||||||
|
('notification', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='msgio.notification')),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
0
msgio/migrations/__init__.py
Normal file
0
msgio/migrations/__init__.py
Normal file
Loading…
Reference in a new issue