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

add migrations for the updated spans table with project id #152

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

dinmukhamedm
Copy link
Member

@dinmukhamedm dinmukhamedm commented Nov 4, 2024

Important

This PR updates the spans table to include project_id as part of the primary key, modifies related constraints and indexes, and updates the labeling_queue_data table and related code to reflect these changes.

  • Database Schema Changes:
    • Add project_id column to spans table, making it part of the primary key.
    • Update spans table with new foreign key spans_project_id_fkey and index spans_project_id_idx.
    • Add span_id column to labeling_queue_data table.
  • Migrations:
    • Rename 0002_next_tusk.sql to 0002_cold_romulus.sql and update to include span_id in labeling_queue_data.
    • Add 0003_cultured_tinkerer.sql to drop and recreate spans_pkey with project_id.
  • Metadata Updates:
    • Update 0002_snapshot.json and 0003_snapshot.json to reflect schema changes.
    • Update _journal.json with new migration entries.
  • Code Updates:
    • Update relations.ts to include project relation in spansRelations.
    • Update schema.ts to define new primary key and foreign key constraints for spans.

This description was created by Ellipsis for bb9b9f9. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to bb9b9f9 in 3 minutes and 37 seconds

More details
  • Looked at 2768 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/lib/db/migrations/0003_cultured_tinkerer.sql:1
  • Draft comment:
    Ensure that the foreign key in the 'labels' table is updated to reference both 'span_id' and 'project_id' from the 'spans' table to maintain referential integrity.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. frontend/lib/db/schema.ts:475
  • Draft comment:
    Update the foreign key in the 'labels' table to reference both 'span_id' and 'project_id' from the 'spans' table to maintain referential integrity.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_otn9HTJrAILNY3sq


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@@ -2,8 +2,8 @@ CREATE TABLE IF NOT EXISTS "labeling_queue_data" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"queue_id" uuid DEFAULT gen_random_uuid() NOT NULL,
"data" jsonb NOT NULL,
"action" jsonb NOT NULL
"action" jsonb NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a foreign key constraint for the 'span_id' column to ensure referential integrity with the 'spans' table.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good suggestion overall, but for us spans are written asynchronously, so they may not be there by the time we write to this table

@dinmukhamedm dinmukhamedm merged commit e456d0b into dev Nov 4, 2024
1 check passed
@dinmukhamedm dinmukhamedm deleted the migrate/spans-project-id branch November 4, 2024 06:48
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