Skip to content

feat: add foreign key relations for cascade deletes to chat tables - #125

Open
Kinbaum wants to merge 1 commit into
midday-ai:mainfrom
Kinbaum:feat-fk-relation
Open

Kinbaum wants to merge 1 commit into
midday-ai:mainfrom
Kinbaum:feat-fk-relation

Conversation

@Kinbaum

@Kinbaum Kinbaum commented Dec 2, 2025 •

Copy link
Copy Markdown

Summary

This PR implements the necessary changes to handle foreign key relationships between the ChatSessions table and its dependent tables ConversationMessages and WorkingMemory. This is useful if a user wants to delete a chat, we can perform a cascading deletion as defined in our schema. The FK constraint is entirely opt-in, but certain order of operations needed to change.

Code changes

  • Modified saveConversation() method: Ensures the chat session row is created/updated before saving messages to prevent FK constraint violations.

Impact

  • None. Users who want FK constraints can opt-in and run their own migrations
  • No breaking changes to API or application logic

@vercel

vercel Bot commented Dec 2, 2025

Copy link
Copy Markdown

@Kinbaum is attempting to deploy a commit to the Pontus Abrahamsson's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Kinbaum

Kinbaum commented Jan 5, 2026

Copy link
Copy Markdown
Author

@pontusab Hey, can I get your review on this PR?

This branch has not been deployed

No deployments
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 this pull request may close these issues.

1 participant