Schema adjustment not being reflected.

Hi guys,

I'm hoping someone may be able to give me hand with this, I'm 90% confident I'm missing an extra step here or something.

I have a /schemas/ folder, with multiple different files and an entry index.ts which exports * from the different files.

Inside my auth.ts file, I have the drizzleAdapter, and I pass in the schemas like so:

import * as schema from "~/server/schema";

// ...rest of config

  database: drizzleAdapter(db, {
    provider: "pg",
    schema: {
      ...schema
    },
  }),


One of the schemas I have defined is named under auth.ts. It includes the user and the session tables. This is what the session table looks like:

export const session = pgTable("session", {
  id: text("id").primaryKey(),
  expiresAt: timestamp("expires_at").notNull(),
  token: text("token").notNull().unique(),
  createdAt: timestamp("created_at").notNull(),
  updatedAt: timestamp("updated_at").notNull(),
  ipAddress: text("ip_address"),
  userAgent: text("user_agent"),
  userId: text("user_id")
    .notNull()
    .references(() => user.id, { onDelete: "cascade" }),
  impersonatedBy: text("impersonated_by"),
  activeOrganizationId: text("active_organization_id"),
});


After making these changes, I have ran npm run db:generate as well as npm run db:push.

When navigating to local.drizzle.studio I can see the extra columns created under the session table.

However, when I use getSession or the database hooks to manipulate the session object, when I hover over the object I see the following structure (Image attached).

Does anyone know how I should go about aligning the better auth types with my DB structs? Thanks
image.png
Was this page helpful?