blob: ae9d2c9cbeb5a1cb2e55dbbcdc28f3a0b99d1790 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
"""invitation links bind no address
A link is now redeemable by whichever account opens it first, so it can be sent
through any messaging service. The address, when the inviter gives one, is only
where the hub mails the link and a masked label in the owner's list.
Revision ID: c4d5e6f7a8b9
Revises: b2c3d4e5f6a7
"""
from collections.abc import Sequence
import sqlalchemy as sa
from alembic import op
revision: str = "c4d5e6f7a8b9"
down_revision: str | Sequence[str] | None = "b2c3d4e5f6a7"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
with op.batch_alter_table("group_invite_links") as batch:
batch.drop_column("email_hash")
batch.alter_column("email_masked", existing_type=sa.String(128), nullable=True)
def downgrade() -> None:
# The bound address cannot be recovered; outstanding links are dropped.
op.execute("DELETE FROM group_invite_links")
with op.batch_alter_table("group_invite_links") as batch:
batch.alter_column("email_masked", existing_type=sa.String(128), nullable=False)
batch.add_column(sa.Column("email_hash", sa.String(64), nullable=False,
server_default=""))
|