Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add get_org_from_ccx_course_url function #607

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;")