-
Notifications
You must be signed in to change notification settings - Fork 6
Migration history fix #43
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| -- Remove deprecated ChallengePhase ordering index and allow AI reviewer flag to be nullable. | ||
|
|
||
| DO | ||
| $$ | ||
| DECLARE | ||
| idx_schema TEXT; | ||
| BEGIN | ||
| SELECT n.nspname | ||
| INTO idx_schema | ||
| FROM pg_class c | ||
| JOIN pg_namespace n ON n.oid = c.relnamespace | ||
| WHERE c.relname = 'challenge_phase_order_idx' | ||
| AND c.relkind = 'i' | ||
| LIMIT 1; | ||
|
|
||
| IF idx_schema IS NOT NULL THEN | ||
| EXECUTE format('DROP INDEX %I.%I', idx_schema, 'challenge_phase_order_idx'); | ||
| END IF; | ||
| END | ||
| $$ LANGUAGE plpgsql; | ||
|
|
||
| DO | ||
| $$ | ||
| DECLARE | ||
| tbl_schema TEXT; | ||
| BEGIN | ||
| SELECT n.nspname | ||
| INTO tbl_schema | ||
| FROM pg_class c | ||
| JOIN pg_namespace n ON n.oid = c.relnamespace | ||
| WHERE c.relname = 'DefaultChallengeReviewer' | ||
| AND c.relkind = 'r' | ||
| LIMIT 1; | ||
|
|
||
| IF tbl_schema IS NULL THEN | ||
| RETURN; | ||
| END IF; | ||
|
|
||
| EXECUTE format( | ||
| 'ALTER TABLE %I.%I ALTER COLUMN %I DROP NOT NULL', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| tbl_schema, | ||
| 'DefaultChallengeReviewer', | ||
| 'isAIReviewer' | ||
| ); | ||
| END | ||
| $$ LANGUAGE plpgsql; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ datasource db { | |
|
|
||
| generator client { | ||
| provider = "prisma-client-js" | ||
| previewFeatures = ["fullTextSearchPostgres", "postgresqlExtensions"] | ||
| previewFeatures = ["fullTextSearchPostgres", "postgresqlExtensions", "views"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| } | ||
|
|
||
| // Enum for allowed challenge track values (matches app-constants) | ||
|
|
@@ -157,7 +157,6 @@ model Challenge { | |
| @@index([status, startDate]) | ||
| @@index([trackId, typeId, status]) | ||
| @@index([status, typeId, trackId, createdAt(sort: Desc)], map: "challenge_status_type_track_created_at_idx") | ||
| @@index([name(ops: raw("pg_catalog.gin_trgm_ops"))], type: Gin, map: "challenge_name_trgm_idx") | ||
| @@index([legacyId]) | ||
| @@index([projectId, status]) | ||
| } | ||
|
|
@@ -166,13 +165,12 @@ model Challenge { | |
| // MemberChallengeAccess view – member/challenge pairs from resources schema | ||
| ////////////////////////////////////////// | ||
|
|
||
| model MemberChallengeAccess { | ||
| view MemberChallengeAccess { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| challengeId String | ||
| memberId String | ||
|
|
||
| challenge Challenge @relation(fields: [challengeId], references: [id]) | ||
|
|
||
| @@id([challengeId, memberId]) | ||
| @@map("MemberChallengeAccess") | ||
| } | ||
|
|
||
|
|
@@ -660,7 +658,7 @@ model DefaultChallengeReviewer { | |
| baseCoefficient Float? | ||
| incrementalCoefficient Float? | ||
| opportunityType ReviewOpportunityTypeEnum? | ||
| isAIReviewer Boolean | ||
| isAIReviewer Boolean? | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| shouldOpenOpportunity Boolean @default(true) | ||
|
|
||
| // Relations | ||
|
|
||
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.
[⚠️
correctness]Consider using
CASCADEwithDROP INDEXif there are any dependent objects that might be affected by the index removal. This ensures that the operation does not fail due to dependencies.