Extension creation in MT migration

This commit is contained in:
joachim-danswer
2025-05-28 15:47:40 -07:00
parent 450c29f4c6
commit c99f28652e
2 changed files with 8 additions and 3 deletions

View File

@@ -27,9 +27,6 @@ depends_on = None
def upgrade() -> None:
# Enable pg_trgm extension if not already enabled
op.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
# Create a new permission-less user to be later used for knowledge graph queries.
# The user will later get temporary read priviledges for a specific view that will be
# ad hoc generated specific to a knowledge graph query.
@@ -38,6 +35,10 @@ def upgrade() -> None:
# environment variables MUST be set. Otherwise, an exception will be raised.
if not MULTI_TENANT:
# Enable pg_trgm extension if not already enabled
op.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
# Create read-only db user here only in single tenant mode. For multi-tenant mode,
# the user is created in the alembic_tenants migration.
if not (DB_READONLY_USER and DB_READONLY_PASSWORD):

View File

@@ -23,6 +23,10 @@ depends_on = None
def upgrade() -> None:
if MULTI_TENANT:
# Enable pg_trgm extension if not already enabled
op.execute("CREATE EXTENSION IF NOT EXISTS pg_trgm")
# Create read-only db user here only in multi-tenant mode. For single-tenant mode,
# the user is created in the standard migration.
if not (DB_READONLY_USER and DB_READONLY_PASSWORD):