Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Conversation API does not work #81

Open
GojoSatoruS opened this issue Nov 28, 2023 · 1 comment · May be fixed by #82
Open

Delete Conversation API does not work #81

GojoSatoruS opened this issue Nov 28, 2023 · 1 comment · May be fixed by #82

Comments

@GojoSatoruS
Copy link

GojoSatoruS commented Nov 28, 2023

Hello,

I'm trying to run the DELETE API under conversations:
getting the following foreign key reference error:
raise translated_error from error sqlalchemy.exc.IntegrityError: (sqlalchemy.dialects.postgresql.asyncpg.IntegrityError) <class 'asyncpg.exceptions.ForeignKeyViolationError'>: update or delete on table "conversation" violates foreign key constraint "message_conversation_id_fkey" on table "message" DETAIL: Key (id)=(79d87f70-4829-41aa-9043-1b61e7888a74) is still referenced from table "message". [SQL: DELETE FROM conversation WHERE conversation.id = $1::UUID] [parameters: ('79d87f70-4829-41aa-9043-1b61e7888a74',)] (Background on this error at: https://sqlalche.me/e/20/gkpj

Any idea how to resolve this?
I have tried to add cascade ON DELETE but alembic migrations are not updating the tables:

class Conversation(Base):
    messages = relationship("Message", back_populates="conversation", cascade="delete, merge, save-update")
    conversation_documents = relationship(
        "ConversationDocument", back_populates="conversation", cascade="delete, merge, save-update"
    )

Any help would be appreciated.

@GojoSatoruS GojoSatoruS changed the title Delete Converation API does not work Delete Conversation API does not work Nov 28, 2023
@arupdeb arupdeb linked a pull request Dec 15, 2023 that will close this issue
@arupdeb
Copy link

arupdeb commented Dec 15, 2023

pull request is added to fix the API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants