mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-03 19:49:17 +02:00
parent
5b18409c89
commit
5596a68d08
@ -19,6 +19,19 @@ DEFAULT_ASSISTANTS = [-2, -1, 0]
|
|||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
def upgrade() -> None:
|
||||||
|
# Step 1: Update any NULL values to the default value
|
||||||
|
op.execute(
|
||||||
|
f"""
|
||||||
|
UPDATE "user"
|
||||||
|
SET chosen_assistants = '{DEFAULT_ASSISTANTS}'
|
||||||
|
WHERE chosen_assistants IS NULL
|
||||||
|
OR chosen_assistants = 'null'
|
||||||
|
OR jsonb_typeof(chosen_assistants) = 'null'
|
||||||
|
OR (jsonb_typeof(chosen_assistants) = 'string' AND chosen_assistants = '"null"')
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
# Step 2: Alter the column to make it non-nullable
|
||||||
op.alter_column(
|
op.alter_column(
|
||||||
"user",
|
"user",
|
||||||
"chosen_assistants",
|
"chosen_assistants",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user