diff --git a/prisma/migrations/20260513120000_add_member_country_indexes/migration.sql b/prisma/migrations/20260513120000_add_member_country_indexes/migration.sql new file mode 100644 index 0000000..8033690 --- /dev/null +++ b/prisma/migrations/20260513120000_add_member_country_indexes/migration.sql @@ -0,0 +1,15 @@ +-- Partial B-tree index for homeCountryCode lookups (only indexes non-NULL rows) +CREATE INDEX "idx_member_home_country_code" + ON members."member" ("homeCountryCode") + WHERE "homeCountryCode" IS NOT NULL; + +-- Partial B-tree index for competitionCountryCode lookups (only indexes non-NULL rows) +CREATE INDEX "idx_member_competition_country_code" + ON members."member" ("competitionCountryCode") + WHERE "competitionCountryCode" IS NOT NULL; + +-- Functional index for case-insensitive country matching via UPPER(country) +-- Not representable in Prisma schema; managed as a raw migration. +CREATE INDEX "idx_member_country_upper" + ON members."member" (UPPER("country")) + WHERE "country" IS NOT NULL; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 14db207..6e998ec 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -81,6 +81,8 @@ model member { @@index([lastLoginDate]) @@index([availableForGigs]) @@index([status, availableForGigs]) + @@index([homeCountryCode], map: "idx_member_home_country_code") + @@index([competitionCountryCode], map: "idx_member_competition_country_code") @@schema("members") }