Skip to content
Migrating from NextAuth.js v4? Read our migration guide.
API reference
lib
Pg

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;
}>;

Type declaration

columns

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;
  }>;
};

columns.access_token

access_token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.expires_at

expires_at: DefaultPostgresColumn<{
  columnType: "PgInteger";
  data: number;
  dataType: "number";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgInteger";
data
data: number;
dataType
dataType: "number";
notNull
notNull: boolean;

columns.id_token

id_token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.provider

provider: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.providerAccountId

providerAccountId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.refresh_token

refresh_token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.scope

scope: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.session_state

session_state: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.token_type

token_type: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.type

type: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.userId

userId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText" | "PgUUID";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "pg";

name

name: string;

schema

schema: string | undefined;

DefaultPostgresSchema

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

Type declaration

accountsTable

accountsTable: DefaultPostgresAccountsTable;

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";
        notNull: true;
     }>;
     userId: DefaultPostgresColumn<{
        columnType: "PgVarchar" | "PgText" | "PgUUID";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
  };
  dialect: "pg";
  name: string;
  schema: string | undefined;
}>;

Type declaration

columns

columns: {
  expires: DefaultPostgresColumn<{
     columnType: "PgTimestamp";
     data: Date;
     dataType: "date";
     notNull: true;
  }>;
  sessionToken: DefaultPostgresColumn<{
     columnType: "PgVarchar" | "PgText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  userId: DefaultPostgresColumn<{
     columnType: "PgVarchar" | "PgText" | "PgUUID";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
};

columns.expires

expires: DefaultPostgresColumn<{
  columnType: "PgTimestamp";
  data: Date;
  dataType: "date";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgTimestamp";
data
data: Date;
dataType
dataType: "date";
notNull
notNull: true;

columns.sessionToken

sessionToken: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.userId

userId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText" | "PgUUID";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "pg";

name

name: string;

schema

schema: string | undefined;

DefaultPostgresUsersTable

type DefaultPostgresUsersTable: PgTableWithColumns<{
  columns: {
     email: DefaultPostgresColumn<{
        columnType: "PgVarchar" | "PgText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     emailVerified: DefaultPostgresColumn<{
        columnType: "PgTimestamp";
        data: Date;
        dataType: "date";
        notNull: boolean;
     }>;
     id: DefaultPostgresColumn<{
        columnType: "PgVarchar" | "PgText" | "PgUUID";
        data: string;
        dataType: "string";
        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;
}>;

Type declaration

columns

columns: {
  email: DefaultPostgresColumn<{
     columnType: "PgVarchar" | "PgText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  emailVerified: DefaultPostgresColumn<{
     columnType: "PgTimestamp";
     data: Date;
     dataType: "date";
     notNull: boolean;
  }>;
  id: DefaultPostgresColumn<{
     columnType: "PgVarchar" | "PgText" | "PgUUID";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  image: DefaultPostgresColumn<{
     columnType: "PgVarchar" | "PgText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  name: DefaultPostgresColumn<{
     columnType: "PgVarchar" | "PgText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
};

columns.email

email: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.emailVerified

emailVerified: DefaultPostgresColumn<{
  columnType: "PgTimestamp";
  data: Date;
  dataType: "date";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgTimestamp";
data
data: Date;
dataType
dataType: "date";
notNull
notNull: boolean;

columns.id

id: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText" | "PgUUID";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.image

image: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.name

name: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

dialect

dialect: "pg";

name

name: string;

schema

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;
}>;

Type declaration

columns

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;
  }>;
};

columns.expires

expires: DefaultPostgresColumn<{
  columnType: "PgTimestamp";
  data: Date;
  dataType: "date";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgTimestamp";
data
data: Date;
dataType
dataType: "date";
notNull
notNull: true;

columns.identifier

identifier: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.token

token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "pg";

name

name: string;

schema

schema: string | undefined;

PostgresDrizzleAdapter()

PostgresDrizzleAdapter(client, schema?): Adapter

Parameters

ParameterType
clientPgDatabase<QueryResultHKT, any, ExtractTablesWithRelations<any>>
schema?DefaultPostgresSchema

Returns

Adapter


defineTables()

defineTables(schema): Required<DefaultPostgresSchema>

Parameters

ParameterType
schemaPartial<DefaultPostgresSchema>

Returns

Required<DefaultPostgresSchema>

Auth.js © Balázs Orbán and Team - 2024