Having trouble understanding type on query with relation

Hi guys,
I'm new to drizzle. I need some help understanding the type that has been infered for my query.

Here are my schemas:

export const missionDbSchema = pgTable(
  'mission',
  {
    contactId: uuid('contact_id').references(() => contactDbSchema.contactId),
    createdAt: timestamp('created_at').default(sql`now()`),
    customerId: uuid('customer_id').references(() => customerDbSchema.customerId),
    description: varchar('description').notNull(),
    job: varchar('job').notNull(),
    label: varchar('label').notNull(),
    missionId: uuid('mission_id').defaultRandom().primaryKey(),
    updatedAt: timestamp('updated_at').default(sql`now()`),
  },
  (mission) => ({ nameIndex: uniqueIndex('mission_idx').on(mission.missionId) }),
export const missionRelations = relations(missionDbSchema, ({ many, one }) => ({
------ nothing related to sponsorship
}))


)


export const sponsorshipDbSchema = pgTable(
  'sponsorship',
  {
    createdAt: timestamp('created_at').default(sql`now()`),
    missionId: uuid('mission_id').references(() => missionDbSchema.missionId),
    sponseeId: uuid('sponsee_id'),
    sponsorshipId: uuid('sponsorship_id').defaultRandom().primaryKey(),
    state: stateEnum('state').default(ContributionStateEnum.ON_HOLD),
    updatedAt: timestamp('updated_at').default(sql`now()`),
    userId: uuid('user_id').references(() => userDbSchema.userId),
  },
  (sponsorship) => ({ nameIndex: uniqueIndex('sponsorship_idx').on(sponsorship.sponsorshipId) }),
)

export const sponsorshipRelations = relations(sponsorshipDbSchema, ({ one }) => ({
  mission: one(missionDbSchema, { fields: [sponsorshipDbSchema.missionId], references: [missionDbSchema.missionId] }),
  user: one(userDbSchema, { fields: [sponsorshipDbSchema.userId], references: [userDbSchema.userId] }),
}))


When I try to query on my sponsorship table by adding mission relation, i got this type. Looks like mission could be an array.
Can someone explain to me where im wrong and why ?
image.png
Was this page helpful?