sprint6+7: permission notifications + audit trail + notification entity filter + mail account permissions + migration 0053
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""Add owner_id to mail_accounts for row-level permissions.
|
||||
|
||||
Revision ID: 0053
|
||||
Revises: 0052
|
||||
Create Date: 2026-07-29
|
||||
|
||||
This migration adds owner_id to mail_accounts so that the universal
|
||||
visibility/permission system (apply_visibility_filter, check_single_entity_access)
|
||||
can be used for mail accounts.
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
revision = "0053"
|
||||
down_revision = "0052"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
op.add_column(
|
||||
"mail_accounts",
|
||||
sa.Column(
|
||||
"owner_id",
|
||||
UUID(as_uuid=True),
|
||||
sa.ForeignKey("users.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_mail_accounts_owner",
|
||||
"mail_accounts",
|
||||
["owner_id"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade():
|
||||
op.drop_index("ix_mail_accounts_owner", table_name="mail_accounts")
|
||||
op.drop_column("mail_accounts", "owner_id")
|
||||
Reference in New Issue
Block a user