Skip to content

Commit

Permalink
Add migration to backfill user.pubid column part 4
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomilov committed Jan 16, 2025
1 parent aeabc83 commit e171b27
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions h/migrations/versions/01c9594fb9d5_backfill_user_pubid_part_4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Backfill user.pubid with unique values part 4."""

from alembic import op
from sqlalchemy.orm import sessionmaker

from h.migrations.versions.f32200e2e496_backfill_user_pubid import backfill_users


revision = "01c9594fb9d5"
down_revision = "9b7171cdeb8a"

USER_PUBID_LENGTH = 12
USER_BATCH_LIMIT = 1000
USER_MAX_COUNT = 3_000_000
USER_PUBID_RETRIES = 5


def upgrade():
session = sessionmaker()(bind=op.get_bind())

backfill_users(
session,
USER_BATCH_LIMIT,
USER_MAX_COUNT,
USER_PUBID_RETRIES,
USER_PUBID_LENGTH,
)


def downgrade():
pass

0 comments on commit e171b27

Please sign in to comment.