Skip to content
The Auth.js project is now part of Better Auth.

lib/pg

DefaultPostgresAccountsTable

type DefaultPostgresAccountsTable = PgTableWithColumns<{  columns: {  access_token: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  expires_at: DefaultPostgresColumn<{  columnType: "PgInteger";  data: number;  dataType: "number";  notNull: boolean;  }>;  id_token: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  provider: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  providerAccountId: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  refresh_token: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  scope: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  session_state: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  token_type: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  type: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  userId: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText" | "PgUUID";  data: string;  dataType: "string";  notNull: true;  }>;  };  dialect: "pg";  name: string;  schema: string | undefined; }>;

DefaultPostgresAuthenticatorTable

type DefaultPostgresAuthenticatorTable = PgTableWithColumns<{  columns: {  counter: DefaultPostgresColumn<{  columnType: "PgInteger";  data: number;  dataType: "number";  notNull: true;  }>;  credentialBackedUp: DefaultPostgresColumn<{  columnType: "PgBoolean";  data: boolean;  dataType: "boolean";  notNull: true;  }>;  credentialDeviceType: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  credentialID: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  credentialPublicKey: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  providerAccountId: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  transports: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: false;  }>;  userId: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText" | "PgUUID";  data: string;  dataType: "string";  notNull: true;  }>;  };  dialect: "pg";  name: string;  schema: string | undefined; }>;

DefaultPostgresSchema

type DefaultPostgresSchema = {  accountsTable: DefaultPostgresAccountsTable;  authenticatorsTable: DefaultPostgresAuthenticatorTable;  sessionsTable: DefaultPostgresSessionsTable;  usersTable: DefaultPostgresUsersTable;  verificationTokensTable: DefaultPostgresVerificationTokenTable; };

Type declaration

accountsTable

accountsTable: DefaultPostgresAccountsTable;

authenticatorsTable?

optional authenticatorsTable: DefaultPostgresAuthenticatorTable;

sessionsTable?

optional sessionsTable: DefaultPostgresSessionsTable;

usersTable

usersTable: DefaultPostgresUsersTable;

verificationTokensTable?

optional verificationTokensTable: DefaultPostgresVerificationTokenTable;

DefaultPostgresSessionsTable

type DefaultPostgresSessionsTable = PgTableWithColumns<{  columns: {  expires: DefaultPostgresColumn<{  columnType: "PgTimestamp";  data: Date;  dataType: "date";  notNull: true;  }>;  sessionToken: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  isPrimaryKey: true;  notNull: true;  }>;  userId: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText" | "PgUUID";  data: string;  dataType: "string";  notNull: true;  }>;  };  dialect: "pg";  name: string;  schema: string | undefined; }>;

DefaultPostgresUsersTable

type DefaultPostgresUsersTable = PgTableWithColumns<{  columns: {  email: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  emailVerified: DefaultPostgresColumn<{  columnType: "PgTimestamp";  data: Date;  dataType: "date";  notNull: boolean;  }>;  id: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText" | "PgUUID";  data: string;  dataType: "string";  isPrimaryKey: true;  notNull: true;  }>;  image: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  name: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: boolean;  }>;  };  dialect: "pg";  name: string;  schema: string | undefined; }>;

DefaultPostgresVerificationTokenTable

type DefaultPostgresVerificationTokenTable = PgTableWithColumns<{  columns: {  expires: DefaultPostgresColumn<{  columnType: "PgTimestamp";  data: Date;  dataType: "date";  notNull: true;  }>;  identifier: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  token: DefaultPostgresColumn<{  columnType: "PgVarchar" | "PgText";  data: string;  dataType: "string";  notNull: true;  }>;  };  dialect: "pg";  name: string;  schema: string | undefined; }>;

defineTables()

function defineTables(schema): Required<DefaultPostgresSchema>

Parameters

ParameterType
schemaPartial<DefaultPostgresSchema>

Returns

Required<DefaultPostgresSchema>


PostgresDrizzleAdapter()

function PostgresDrizzleAdapter(client, schema?): Adapter

Parameters

ParameterType
clientPgDatabase<PgQueryResultHKT, any>
schema?DefaultPostgresSchema

Returns

Adapter

Auth.js © Better Auth Inc. - 2025