Some checks failed
Build and Deploy Backend / build-and-deploy (push) Failing after 1m36s
99 lines
3.2 KiB
Python
99 lines
3.2 KiB
Python
# Generated by Django 4.2 on 2026-02-09 06:31
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Notification",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.BigAutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
(
|
|
"type",
|
|
models.CharField(
|
|
choices=[
|
|
("system", "系统通知"),
|
|
("device", "设备通知"),
|
|
("activity", "活动通知"),
|
|
],
|
|
default="system",
|
|
max_length=20,
|
|
verbose_name="通知类型",
|
|
),
|
|
),
|
|
("title", models.CharField(max_length=200, verbose_name="标题")),
|
|
(
|
|
"description",
|
|
models.CharField(
|
|
blank=True, default="", max_length=500, verbose_name="摘要"
|
|
),
|
|
),
|
|
(
|
|
"content",
|
|
models.TextField(blank=True, default="", verbose_name="内容"),
|
|
),
|
|
(
|
|
"image_url",
|
|
models.URLField(
|
|
blank=True, default="", max_length=500, verbose_name="图片URL"
|
|
),
|
|
),
|
|
(
|
|
"is_read",
|
|
models.BooleanField(default=False, verbose_name="是否已读"),
|
|
),
|
|
(
|
|
"created_at",
|
|
models.DateTimeField(auto_now_add=True, verbose_name="创建时间"),
|
|
),
|
|
(
|
|
"updated_at",
|
|
models.DateTimeField(auto_now=True, verbose_name="更新时间"),
|
|
),
|
|
(
|
|
"user",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
related_name="notifications",
|
|
to=settings.AUTH_USER_MODEL,
|
|
verbose_name="用户",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"verbose_name": "通知",
|
|
"verbose_name_plural": "通知",
|
|
"db_table": "notification",
|
|
"ordering": ["-created_at"],
|
|
},
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="notification",
|
|
index=models.Index(
|
|
fields=["user", "is_read"], name="notificatio_user_id_d569bc_idx"
|
|
),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name="notification",
|
|
index=models.Index(fields=["type"], name="notificatio_type_f65c28_idx"),
|
|
),
|
|
]
|