Skip to content
This repository has been archived by the owner on Jan 5, 2025. It is now read-only.

Commit

Permalink
Fixing migration to handle existing column
Browse files Browse the repository at this point in the history
  • Loading branch information
codebanesr committed Dec 12, 2023
1 parent c765339 commit 6c7430d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion llm-server/models/alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
script_location = migrations
prepend_sys_path = .
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
sqlalchemy.url = mysql+pymysql://dbuser:dbpass@localhost:3307/opencopilot
sqlalchemy.url = mysql+pymysql://dbuser:dbpass@mysql:3306/opencopilot

[post_write_hooks]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@ def upgrade():
.execute(sa.text("SHOW COLUMNS FROM chatbots LIKE 'summary_prompt'"))
.fetchone()
):
op.add_column(
"chatbots",
sa.Column(
"summary_prompt",
sa.Text(),
nullable=False,
server_default=(
"Given a JSON response, summarize the key information in a concise manner. "
"Include relevant details, references, and links if present. "
"Format the summary in Markdown for clarity and readability."
),
),
)
op.add_column("chatbots", sa.Column("summary_prompt", sa.Text(), nullable=True))

op.execute(
"""
UPDATE chatbots
SET summary_prompt = "Given a JSON response, summarize the key information in a concise manner. Include relevant details, references, and links if present. Format the summary in Markdown for clarity and readability."
"""
)

op.alter_column(
"chatbots", "summary_prompt", existing_type=sa.TEXT(), nullable=False
)


def downgrade():
Expand Down

0 comments on commit 6c7430d

Please sign in to comment.