Skip to content

Commit 7eb1972

Browse files
Adds support for extra context in conversations
Enables richer data storage for conversations by introducing a JSONB field for extra context. Links products to support groups, improving flexibility in product support management via a new nullable foreign key. Facilitates future enhancements in conversation and product handling.
1 parent e513c15 commit 7eb1972

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""modify conversations
2+
3+
Revision ID: b566f1b29012
4+
Revises: 5679165336c8
5+
Create Date: 2025-08-14 15:02:54.784186+00:00
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = "b566f1b29012"
15+
down_revision = "5679165336c8"
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.add_column(
23+
"conversations",
24+
sa.Column(
25+
"extra_context",
26+
postgresql.JSONB(astext_type=sa.Text()),
27+
server_default=sa.text("'{}'::jsonb"),
28+
nullable=False,
29+
),
30+
)
31+
op.add_column(
32+
"products",
33+
sa.Column("support_standard_group_id", sa.BigInteger(), nullable=True),
34+
)
35+
op.create_foreign_key(
36+
"fk_products_support_standard_group_id",
37+
"products",
38+
"groups",
39+
["support_standard_group_id"],
40+
["gid"],
41+
onupdate="CASCADE",
42+
ondelete="SET NULL",
43+
)
44+
# ### end Alembic commands ###
45+
46+
47+
def downgrade():
48+
# ### commands auto generated by Alembic - please adjust! ###
49+
op.drop_constraint(
50+
"fk_products_support_standard_group_id", "products", type_="foreignkey"
51+
)
52+
op.drop_column("products", "support_standard_group_id")
53+
op.drop_column("conversations", "extra_context")
54+
# ### end Alembic commands ###

0 commit comments

Comments
 (0)