1d26646a96
- 新增协作文件夹、文件、不可变修订、成员、会话、回调回执、编辑申请与分享链接数据模型。 - 补齐新建、导入、复制、下载、回收站、恢复、成员授权、所有权转让及文件级权限接口。 - 接入 ONLYOFFICE 共同编辑、历史版本预览与恢复、修订另存副本、导出下载审计和幂等回调保存。 - 增加编辑权限申请、审批通知、项目提醒聚合、通知 Feed、已读处理及历史待办数据回填。 - 支持公开分享的查看或编辑模式、有效期、密码哈希、失败锁定、短时访问凭证与固定分享地址。 - 增加协作者导出、申请编辑、工作表结构保护和所有权管理策略,并纳入项目接口权限矩阵。 - 新增协作文件库、编辑工作区、公开分享页、下载与另存为对话框,以及导航、路由和权限入口。 - 统一网页端与桌面端通知布局,增加沉浸式工作区和浏览器、Tauri 双端全屏能力。 - 扩展运行时文件下载适配、Tauri 环境识别和原生全屏命令,继续保持业务代码运行时边界。 - 加固 ONLYOFFICE 消息桥的同源下载、签名地址隔离和保存为能力校验,并更新桌面发布检查。 - 增加连续数据库迁移、50MB 上传限制、OnlyOffice 中文文案与开发启动路由校验。 - 补充协作、通知、权限、路由、运行时、布局和 OnlyOffice 相关测试及模块说明文档。
54 lines
2.4 KiB
Python
54 lines
2.4 KiB
Python
"""Add recipient-scoped generic notifications.
|
|
|
|
Revision ID: 20260716_01
|
|
Revises: 20260715_06
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
|
|
revision = "20260716_01"
|
|
down_revision = "20260715_06"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"notifications",
|
|
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column("study_id", postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column("recipient_id", postgresql.UUID(as_uuid=True), nullable=False),
|
|
sa.Column("category", sa.String(length=64), nullable=False),
|
|
sa.Column("priority", sa.String(length=16), nullable=False, server_default="NORMAL"),
|
|
sa.Column("title", sa.String(length=180), nullable=False),
|
|
sa.Column("message", sa.String(length=500), nullable=False),
|
|
sa.Column("action_path", sa.Text(), nullable=True),
|
|
sa.Column("source_type", sa.String(length=64), nullable=False),
|
|
sa.Column("source_id", sa.String(length=100), nullable=False),
|
|
sa.Column("source_version", sa.String(length=100), nullable=True),
|
|
sa.Column("dedupe_key", sa.String(length=255), nullable=False),
|
|
sa.Column("read_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("resolved_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
|
|
sa.ForeignKeyConstraint(["recipient_id"], ["users.id"], ondelete="CASCADE"),
|
|
sa.ForeignKeyConstraint(["study_id"], ["studies.id"], ondelete="CASCADE"),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("recipient_id", "dedupe_key", name="uq_notifications_recipient_dedupe"),
|
|
)
|
|
op.create_index(
|
|
"ix_notifications_recipient_study_state",
|
|
"notifications",
|
|
["recipient_id", "study_id", "resolved_at", "read_at", "created_at"],
|
|
)
|
|
op.create_index("ix_notifications_source", "notifications", ["source_type", "source_id"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_notifications_source", table_name="notifications")
|
|
op.drop_index("ix_notifications_recipient_study_state", table_name="notifications")
|
|
op.drop_table("notifications")
|