/**
 * Migration tolerance.
 *
 * Convention established in Tasks 39-48: a page must never 500 because a
 * migration has not been applied to the running database yet. The pattern is
 * always the same — attempt the query the new schema supports, and if
 * Postgres rejects it because a column does not exist, fall back to what the
 * older schema does have.
 *
 * See `src/app/api/trips/[id]/invite/route.ts` for the original inline
 * version of this (phone_ext / migration 0007).
 */
export function isMissingColumn(
  error: { message?: string } | null | undefined,
  ...columns: string[]
): boolean {
  const message = error?.message
  if (!message) return false
  return columns.some((column) => message.includes(column))
}
