Skip to content

Commit

Permalink
Migration to include the full "us.lms.org" in Organization.public_id
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospri committed Jun 4, 2024
1 parent 9ebde48 commit cc93e48
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lms/migrations/versions/b512a5cf64ed_public_id_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""Public ID migration
Revision ID: b512a5cf64ed
Revises: 329313b38de1
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

revision = "b512a5cf64ed"
down_revision = "329313b38de1"


def upgrade() -> None:
conn = op.get_bind()
conn.execute(
sa.text(
"""UPDATE "organization" set public_id = 'us.lms.org.' || "public_id";"""
)
)


def downgrade() -> None:
conn = op.get_bind()
conn.execute(
sa.text(
"""UPDATE "organization" set public_id = split_part("public_id", '.', 4);"""
)
)

0 comments on commit cc93e48

Please sign in to comment.