-- Add missing indexes on foreign key columns used in filtering/joining.
-- These are CREATE INDEX IF NOT EXISTS so they are safe to re-run.

-- Resource: blueprintId and roleId are used in resource filtering and joins
CREATE INDEX CONCURRENTLY IF NOT EXISTS "resources_blueprintId_idx" ON "resources" ("blueprintId");
CREATE INDEX CONCURRENTLY IF NOT EXISTS "resources_roleId_idx" ON "resources" ("roleId");

-- DemandRequirement: roleId is used in role-based demand queries
CREATE INDEX CONCURRENTLY IF NOT EXISTS "demand_requirements_roleId_idx" ON "demand_requirements" ("roleId");

-- Assignment: roleId is used in role-based assignment queries
CREATE INDEX CONCURRENTLY IF NOT EXISTS "assignments_roleId_idx" ON "assignments" ("roleId");
