跳至内容
从 NextAuth.js v4 迁移?阅读 我们的迁移指南.

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

类型声明

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;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: boolean;

columns.expires_at

expires_at: DefaultPostgresColumn<{
  columnType: "PgInteger";
  data: number;
  dataType: "number";
  notNull: boolean;
}>;
类型声明
列类型
columnType: "PgInteger";
数据
data: number;
数据类型
dataType: "number";
非空
notNull: boolean;

columns.id_token

id_token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: boolean;

columns.provider

provider: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: true;

columns.providerAccountId

providerAccountId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: true;

columns.refresh_token

refresh_token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: boolean;

columns.scope

scope: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: boolean;

columns.session_state

session_state: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: boolean;

columns.token_type

token_type: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: boolean;

columns.type

type: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
列类型
columnType: "PgVarchar" | "PgText";
数据
data: string;
数据类型
dataType: "string";
非空
notNull: true;

columns.userId

userId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText" | "PgUUID";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "pg";

name

name: string;

schema

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

类型声明

columns

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

columns.counter

counter: DefaultPostgresColumn<{
  columnType: "PgInteger";
  data: number;
  dataType: "number";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgInteger";
data
data: number;
dataType
dataType: "number";
notNull
notNull: true;

columns.credentialBackedUp

credentialBackedUp: DefaultPostgresColumn<{
  columnType: "PgBoolean";
  data: boolean;
  dataType: "boolean";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgBoolean";
data
data: boolean;
dataType
dataType: "boolean";
notNull
notNull: true;

columns.credentialDeviceType

credentialDeviceType: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.credentialID

credentialID: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.credentialPublicKey

credentialPublicKey: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
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;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.transports

transports: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: false;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: false;

columns.userId

userId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
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;
  authenticatorsTable: DefaultPostgresAuthenticatorTable;
  sessionsTable: DefaultPostgresSessionsTable;
  usersTable: DefaultPostgresUsersTable;
  verificationTokensTable: DefaultPostgresVerificationTokenTable;
};

类型声明

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

类型声明

columns

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

columns.expires

expires: DefaultPostgresColumn<{
  columnType: "PgTimestamp";
  data: Date;
  dataType: "date";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgTimestamp";
data
data: Date;
dataType
dataType: "date";
notNull
notNull: true;

columns.sessionToken

sessionToken: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  isPrimaryKey: true;
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
isPrimaryKey
isPrimaryKey: true;
notNull
notNull: true;

columns.userId

userId: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
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: 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;
}>;

类型声明

columns

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

columns.email

email: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.emailVerified

emailVerified: DefaultPostgresColumn<{
  columnType: "PgTimestamp";
  data: Date;
  dataType: "date";
  notNull: boolean;
}>;
类型声明
columnType
columnType: "PgTimestamp";
data
data: Date;
dataType
dataType: "date";
notNull
notNull: boolean;

columns.id

id: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText" | "PgUUID";
  data: string;
  dataType: "string";
  isPrimaryKey: true;
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText" | "PgUUID";
data
data: string;
dataType
dataType: "string";
isPrimaryKey
isPrimaryKey: true;
notNull
notNull: true;

columns.image

image: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
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;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

dialect

dialect: "pg";

name

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

类型声明

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;
}>;
类型声明
columnType
columnType: "PgTimestamp";
数据
data: Date;
dataType
dataType: "date";
notNull
notNull: true;

columns.identifier

identifier: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
数据
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.token

token: DefaultPostgresColumn<{
  columnType: "PgVarchar" | "PgText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "PgVarchar" | "PgText";
数据
data: string;
dataType
dataType: "string";
notNull
notNull: true;

方言

dialect: "pg";

名称

name: string;

模式

schema: string | undefined;

PostgresDrizzleAdapter()

PostgresDrizzleAdapter(client, schema?): Adapter

参数

参数类型
客户端PgDatabase<PgQueryResultHKT, any, ExtractTablesWithRelations<any>>
模式?DefaultPostgresSchema

返回值

适配器


defineTables()

defineTables(schema): Required<DefaultPostgresSchema>

参数

参数类型
模式Partial<DefaultPostgresSchema>

返回值

Required<DefaultPostgresSchema>

Auth.js © Balázs Orbán 和团队 -2024