-
-
Notifications
You must be signed in to change notification settings - Fork 8
fix: comprehensive schema normalization and constraint fixes #714
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
Merged
ngoiyaeric
merged 2 commits into
QueueLab:main
from
ngoiyaeric:fix/comprehensive-schema-fix
Jul 9, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| -- Migration 0007: Create missing prompt_generation_jobs table | ||
| -- This table was defined in schema.ts and migration 0002 but was never applied to production. | ||
|
|
||
| CREATE TABLE IF NOT EXISTS "prompt_generation_jobs" ( | ||
| "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, | ||
| "user_id" uuid NOT NULL, | ||
| "domain" text NOT NULL, | ||
| "status" text DEFAULT 'pending' NOT NULL, | ||
| "result_prompt" text, | ||
| "error_message" text, | ||
| "created_at" timestamp with time zone DEFAULT now() NOT NULL, | ||
| "updated_at" timestamp with time zone DEFAULT now() NOT NULL | ||
| ); | ||
| --> statement-breakpoint | ||
| ALTER TABLE "prompt_generation_jobs" ADD CONSTRAINT "prompt_generation_jobs_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action NOT VALID; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "prompt_generation_jobs" VALIDATE CONSTRAINT "prompt_generation_jobs_user_id_fkey"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| -- Migration 0008: Allow 'data' as a valid message role | ||
| -- The messages_role_check constraint currently only allows: user, assistant, system, tool | ||
| -- Internal context messages (drawing context, calendar notes) use role 'data' | ||
| -- This migration adds 'data' to the allowed values. | ||
| -- NOTE: updateDrawingContext and calendar.ts have been updated to use 'tool' instead of 'data'. | ||
| -- This migration is preventive: if any future code needs role 'data', it will be available. | ||
|
|
||
| ALTER TABLE "messages" DROP CONSTRAINT IF EXISTS "messages_role_check"; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "messages" ADD CONSTRAINT "messages_role_check" CHECK (role = ANY (ARRAY['user'::text, 'assistant'::text, 'system'::text, 'tool'::text, 'data'::text])) NOT VALID; | ||
| --> statement-breakpoint | ||
| ALTER TABLE "messages" VALIDATE CONSTRAINT "messages_role_check"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: QueueLab/QCX
Length of output: 14446
🏁 Script executed:
Repository: QueueLab/QCX
Length of output: 4245
Avoid double-stringifying the drawing-context tool payload.
app/actions.tsx:377-388stringifies everytoolmessage again before sending it toresearcher, so the JSON string saved inlib/actions/chat.tsbecomes an escaped string instead of the original payload. Keep the existing string as-is for this path, or stringify in one place only.🤖 Prompt for AI Agents