Template
Extract always-on public/portal/UTM plus optional email_sms, directmail, blog, payments, social, and social_ai so new client sites can be bootstrapped from this seed. Refs #1 Refs #2 Co-authored-by: Cursor <cursoragent@cursor.com>
94 lines
5.3 KiB
Python
94 lines
5.3 KiB
Python
# Generated by Django 6.1 on 2026-08-26 11:38
|
|
|
|
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 = [
|
|
('contacts', '0001_initial'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='MessageTemplate',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=120)),
|
|
('channel', models.CharField(choices=[('email', 'Email'), ('sms', 'SMS'), ('postcard', 'Postcard')], max_length=16)),
|
|
('subject', models.CharField(blank=True, max_length=255)),
|
|
('body', models.TextField()),
|
|
('postcard_front', models.JSONField(blank=True, default=dict)),
|
|
('postcard_back', models.JSONField(blank=True, default=dict)),
|
|
],
|
|
options={
|
|
'abstract': False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Campaign',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('name', models.CharField(max_length=120)),
|
|
('channel', models.CharField(choices=[('email', 'Email'), ('sms', 'SMS'), ('postcard', 'Postcard')], max_length=16)),
|
|
('audience', models.CharField(blank=True, choices=[('postcard_opt_in', 'Mailing list · postcard opt-in')], default='', max_length=32)),
|
|
('status', models.CharField(choices=[('draft', 'Draft'), ('scheduled', 'Scheduled'), ('sending', 'Sending'), ('completed', 'Completed'), ('cancelled', 'Cancelled')], default='draft', max_length=16)),
|
|
('scheduled_for', models.DateTimeField(blank=True, null=True)),
|
|
('subject_override', models.CharField(blank=True, max_length=255)),
|
|
('body_override', models.TextField(blank=True)),
|
|
('notify_sent_at', models.DateTimeField(blank=True, null=True)),
|
|
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='directmail_campaigns_created', to=settings.AUTH_USER_MODEL)),
|
|
('template', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='directmail_campaigns', to='directmail.messagetemplate')),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Message',
|
|
fields=[
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('channel', models.CharField(choices=[('email', 'Email'), ('sms', 'SMS'), ('postcard', 'Postcard')], max_length=16)),
|
|
('status', models.CharField(choices=[('draft', 'Draft'), ('scheduled', 'Scheduled'), ('queued', 'Queued'), ('sent', 'Sent'), ('delivered', 'Delivered'), ('opened', 'Opened'), ('clicked', 'Clicked'), ('failed', 'Failed'), ('bounced', 'Bounced'), ('suppressed', 'Suppressed')], default='draft', max_length=16)),
|
|
('provider', models.CharField(blank=True, max_length=64)),
|
|
('provider_message_id', models.CharField(blank=True, max_length=255)),
|
|
('scheduled_for', models.DateTimeField(blank=True, null=True)),
|
|
('sent_at', models.DateTimeField(blank=True, null=True)),
|
|
('error', models.TextField(blank=True)),
|
|
('body_snapshot', models.TextField(blank=True)),
|
|
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='messages', to='directmail.campaign')),
|
|
('contact', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='directmail_messages', to='contacts.contact')),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='ProviderEvent',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('provider', models.CharField(max_length=64)),
|
|
('event_type', models.CharField(max_length=64)),
|
|
('payload', models.JSONField(blank=True, default=dict)),
|
|
('message', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='directmail.message')),
|
|
],
|
|
options={
|
|
'abstract': False,
|
|
},
|
|
),
|
|
]
|