diff options
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/db/migrations')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/db/migrations/versions/c5e93b1a2f60_keep_username_on_ip_logs.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/db/migrations/versions/c5e93b1a2f60_keep_username_on_ip_logs.py b/packages/meshbay-hub/src/meshbay_hub/db/migrations/versions/c5e93b1a2f60_keep_username_on_ip_logs.py new file mode 100644 index 0000000..cfa3229 --- /dev/null +++ b/packages/meshbay-hub/src/meshbay_hub/db/migrations/versions/c5e93b1a2f60_keep_username_on_ip_logs.py @@ -0,0 +1,31 @@ +"""keep_username_on_ip_logs + +The connection log is kept for its legal retention period and is meant to stay +attributable. It took the name from a join on `users`, and account deletion +tombstones that row — so the log answered `deleted-3f9a1c` for precisely the +records someone would be asking about. The name is copied onto the log rows at +deletion; it stays NULL while the account is alive, where the join is better +because it cannot go stale. + +Revision ID: c5e93b1a2f60 +Revises: b4d82e1c77a9 +Create Date: 2026-08-15 + +""" +from typing import Sequence, Union + +import sqlalchemy as sa +from alembic import op + +revision: str = 'c5e93b1a2f60' +down_revision: Union[str, Sequence[str], None] = 'b4d82e1c77a9' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + op.add_column('ip_logs', sa.Column('username', sa.String(64), nullable=True)) + + +def downgrade() -> None: + op.drop_column('ip_logs', 'username') |