Using existing DB schema with Drizzle

I created a schema for the better auth table called better-auth which I'm passing as auth options to the drizzle adapter. However when I run the cli command to generate the schemas, the better-auth schema isn't being used. Is there a way to use the custom schema I created?
The following is my authOptions which I'm sharing between the actual auth instance and a fake one which is used with the cli.
export const authOptions: BetterAuthOptions = {
  database: drizzleAdapter(
    {},
    {
      provider: 'pg',
      schema: betterAuthSchema,
    },
  ),
  emailAndPassword: {
    enabled: true,
    requireEmailVerification: true,
  },
  emailVerification: {
    sendVerificationEmail: (_, _request) => {
      // TODO: Implement email sending logic
      console.log('Sending verification email');
      return Promise.resolve();
    },
  },
  account: {
    accountLinking: {
      enabled: true,
    },
  },
  user: {
    deleteUser: {
      enabled: true,
    },
  },
  socialProviders: {
    github: {
      clientId: '',
      clientSecret: '',
    },
  },
  advanced: {
    defaultCookieAttributes: {
      secure: true,
      sameSite: 'none',
    },
  },
  plugins: [admin()],
};
Was this page helpful?