Skip to content

Commit

Permalink
feat: add get_org_from_ccx_course_url function
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Feb 16, 2024
1 parent be43197 commit 55caee7
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Create the get_org_from_ccx_course_url function to support CCX courses
"""
from alembic import op


revision = "0033"
down_revision = "0032"
branch_labels = None
depends_on = None
on_cluster = " ON CLUSTER '{{CLICKHOUSE_CLUSTER_NAME}}' " if "{{CLICKHOUSE_CLUSTER_NAME}}" else ""

def upgrade():
op.execute(
f"""
CREATE OR REPLACE FUNCTION get_org_from_ccx_course_url {on_cluster}
AS (
course_url) ->
nullIf(EXTRACT(course_url, 'ccx-v1:([a-zA-Z0-9]*)'), '');
"""
)



def downgrade():
op.execute("DROP FUNCTION IF EXISTS get_org_from_ccx_course_url;")

0 comments on commit 55caee7

Please sign in to comment.