Skip to content
Merged
Show file tree
Hide file tree
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
126 changes: 126 additions & 0 deletions alembic/versions/150ac8a20e59_change_schema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
"""change schema

Revision ID: 150ac8a20e59
Revises: 7334713b30a6
Create Date: 2025-07-29 12:44:15.804586

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "150ac8a20e59"
down_revision = "7334713b30a6"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"sharepoint_property_sync",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.Column("integration_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("config", sa.JSON(), nullable=True),
sa.Column("logs", sa.ARRAY(sa.String()), nullable=True),
sa.Column("state", sa.String(), nullable=True),
sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(
["integration_id"], ["cognition.integration.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
schema="integration",
)
op.create_index(
op.f("ix_integration_sharepoint_property_sync_created_by"),
"sharepoint_property_sync",
["created_by"],
unique=False,
schema="integration",
)
op.create_index(
op.f("ix_integration_sharepoint_property_sync_integration_id"),
"sharepoint_property_sync",
["integration_id"],
unique=False,
schema="integration",
)
op.drop_index(
"ix_sharepoint_property_sync_created_by", table_name="sharepoint_property_sync"
)
op.drop_index(
"ix_sharepoint_property_sync_integration_id",
table_name="sharepoint_property_sync",
)
op.drop_table("sharepoint_property_sync")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"sharepoint_property_sync",
sa.Column("id", postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column("created_by", postgresql.UUID(), autoincrement=False, nullable=True),
sa.Column(
"created_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
),
sa.Column(
"updated_at", postgresql.TIMESTAMP(), autoincrement=False, nullable=True
),
sa.Column(
"integration_id", postgresql.UUID(), autoincrement=False, nullable=True
),
sa.Column(
"config",
postgresql.JSON(astext_type=sa.Text()),
autoincrement=False,
nullable=True,
),
sa.Column(
"logs", postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True
),
sa.Column("state", sa.VARCHAR(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(
["created_by"],
["user.id"],
name="sharepoint_property_sync_created_by_fkey",
ondelete="SET NULL",
),
sa.ForeignKeyConstraint(
["integration_id"],
["cognition.integration.id"],
name="sharepoint_property_sync_integration_id_fkey",
ondelete="CASCADE",
),
sa.PrimaryKeyConstraint("id", name="sharepoint_property_sync_pkey"),
)
op.create_index(
"ix_sharepoint_property_sync_integration_id",
"sharepoint_property_sync",
["integration_id"],
unique=False,
)
op.create_index(
"ix_sharepoint_property_sync_created_by",
"sharepoint_property_sync",
["created_by"],
unique=False,
)
op.drop_index(
op.f("ix_integration_sharepoint_property_sync_integration_id"),
table_name="sharepoint_property_sync",
schema="integration",
)
op.drop_index(
op.f("ix_integration_sharepoint_property_sync_created_by"),
table_name="sharepoint_property_sync",
schema="integration",
)
op.drop_table("sharepoint_property_sync", schema="integration")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""add integration sharepoint property sync

Revision ID: 7334713b30a6
Revises: 6868ac66ea92
Create Date: 2025-07-29 12:31:04.171629

"""

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "7334713b30a6"
down_revision = "312568866ac4"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"sharepoint_property_sync",
sa.Column("id", postgresql.UUID(as_uuid=True), nullable=False),
sa.Column("created_by", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("created_at", sa.DateTime(), nullable=True),
sa.Column("updated_at", sa.DateTime(), nullable=True),
sa.Column("integration_id", postgresql.UUID(as_uuid=True), nullable=True),
sa.Column("config", sa.JSON(), nullable=True),
sa.Column("logs", sa.ARRAY(sa.String()), nullable=True),
sa.Column("state", sa.String(), nullable=True),
sa.ForeignKeyConstraint(["created_by"], ["user.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(
["integration_id"], ["cognition.integration.id"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_sharepoint_property_sync_created_by"),
"sharepoint_property_sync",
["created_by"],
unique=False,
)
op.create_index(
op.f("ix_sharepoint_property_sync_integration_id"),
"sharepoint_property_sync",
["integration_id"],
unique=False,
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
op.f("ix_sharepoint_property_sync_integration_id"),
table_name="sharepoint_property_sync",
)
op.drop_index(
op.f("ix_sharepoint_property_sync_created_by"),
table_name="sharepoint_property_sync",
)
op.drop_table("sharepoint_property_sync")
# ### end Alembic commands ###
2 changes: 2 additions & 0 deletions controller/attribute/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ def calculate_user_attribute_sample_records(
if (
attribute.get(project_id, attribute_id).data_type
== DataTypes.EMBEDDING_LIST.value
or attribute.get(project_id, attribute_id).data_type
== DataTypes.TEXT_LIST.value
):
# values are json serialized so they can be easily transferred to the frontend.
# Since the return type is a list of strings, without json.dumps a str(xxxx) will be called
Expand Down
1 change: 1 addition & 0 deletions service/search/search_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def build_order_by_table_select(
DataTypes.CATEGORY.value: "TEXT",
DataTypes.TEXT.value: "TEXT",
DataTypes.LLM_RESPONSE.value: "TEXT",
DataTypes.TEXT_LIST.value: "TEXT",
}


Expand Down
Loading