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

lib/mysql

DefaultMySqlAccountsTable

type DefaultMySqlAccountsTable: MySqlTableWithColumns<{
  columns: {
     access_token: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        driverParam: string | number;
        notNull: boolean;
     }>;
     expires_at: DefaultMyqlColumn<{
        columnType: "MySqlInt";
        data: number;
        dataType: "number";
        notNull: boolean;
     }>;
     id_token: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     provider: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     providerAccountId: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     refresh_token: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     scope: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     session_state: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     token_type: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     type: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     userId: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
  };
  dialect: "mysql";
  name: string;
  schema: string | undefined;
}>;

类型声明

columns: {
  access_token: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     driverParam: string | number;
     notNull: boolean;
  }>;
  expires_at: DefaultMyqlColumn<{
     columnType: "MySqlInt";
     data: number;
     dataType: "number";
     notNull: boolean;
  }>;
  id_token: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  provider: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  providerAccountId: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  refresh_token: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  scope: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  session_state: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  token_type: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  type: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  userId: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
};

列.access_token

access_token: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  driverParam: string | number;
  notNull: boolean;
}>;
类型声明
列类型
columnType: "MySqlVarChar" | "MySqlText";
数据
data: string;
数据类型
dataType: "string";
驱动程序参数
driverParam: string | number;
非空
notNull: boolean;

列.expires_at

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

列.id_token

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

列.provider

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

列.providerAccountId

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

列.refresh_token

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

列.scope

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

列.session_state

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

列.token_type

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

columns.type

type: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.userId

userId: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "mysql";

name

name: string;

schema

schema: string | undefined;

DefaultMySqlAuthenticatorTable

type DefaultMySqlAuthenticatorTable: MySqlTableWithColumns<{
  columns: {
     counter: DefaultMyqlColumn<{
        columnType: "MySqlInt";
        data: number;
        dataType: "number";
        notNull: true;
     }>;
     credentialBackedUp: DefaultMyqlColumn<{
        columnType: "MySqlBoolean";
        data: boolean;
        dataType: "boolean";
        notNull: true;
     }>;
     credentialDeviceType: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     credentialID: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     credentialPublicKey: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     providerAccountId: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     transports: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: false;
     }>;
     userId: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
  };
  dialect: "mysql";
  name: string;
  schema: string | undefined;
}>;

类型声明

columns

columns: {
  counter: DefaultMyqlColumn<{
     columnType: "MySqlInt";
     data: number;
     dataType: "number";
     notNull: true;
  }>;
  credentialBackedUp: DefaultMyqlColumn<{
     columnType: "MySqlBoolean";
     data: boolean;
     dataType: "boolean";
     notNull: true;
  }>;
  credentialDeviceType: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  credentialID: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  credentialPublicKey: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  providerAccountId: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  transports: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: false;
  }>;
  userId: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
};

columns.counter

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

columns.credentialBackedUp

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

columns.credentialDeviceType

credentialDeviceType: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.credentialID

credentialID: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.credentialPublicKey

credentialPublicKey: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.providerAccountId

providerAccountId: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.transports

transports: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: false;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: false;

columns.userId

userId: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "mysql";

name

name: string;

schema

schema: string | undefined;

DefaultMySqlSchema

type DefaultMySqlSchema: {
  accountsTable: DefaultMySqlAccountsTable;
  authenticatorsTable: DefaultMySqlAuthenticatorTable;
  sessionsTable: DefaultMySqlSessionsTable;
  usersTable: DefaultMySqlUsersTable;
  verificationTokensTable: DefaultMySqlVerificationTokenTable;
};

类型声明

accountsTable

accountsTable: DefaultMySqlAccountsTable;

authenticatorsTable?

optional authenticatorsTable: DefaultMySqlAuthenticatorTable;

sessionsTable?

optional sessionsTable: DefaultMySqlSessionsTable;

usersTable

usersTable: DefaultMySqlUsersTable;

verificationTokensTable?

optional verificationTokensTable: DefaultMySqlVerificationTokenTable;

DefaultMySqlSessionsTable

type DefaultMySqlSessionsTable: MySqlTableWithColumns<{
  columns: {
     expires: DefaultMyqlColumn<{
        columnType: "MySqlTimestamp";
        data: Date;
        dataType: "date";
        notNull: true;
     }>;
     sessionToken: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        isPrimaryKey: true;
        notNull: true;
     }>;
     userId: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
  };
  dialect: "mysql";
  name: string;
  schema: string | undefined;
}>;

类型声明

columns

columns: {
  expires: DefaultMyqlColumn<{
     columnType: "MySqlTimestamp";
     data: Date;
     dataType: "date";
     notNull: true;
  }>;
  sessionToken: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     isPrimaryKey: true;
     notNull: true;
  }>;
  userId: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
};

columns.expires

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

columns.sessionToken

sessionToken: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  isPrimaryKey: true;
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
isPrimaryKey
isPrimaryKey: true;
notNull
notNull: true;

columns.userId

userId: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "mysql";

name

name: string;

schema

schema: string | undefined;

DefaultMySqlUsersTable

type DefaultMySqlUsersTable: MySqlTableWithColumns<{
  columns: {
     email: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     emailVerified: DefaultMyqlColumn<{
        columnType: "MySqlTimestamp";
        data: Date;
        dataType: "date";
        notNull: boolean;
     }>;
     id: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        isPrimaryKey: true;
        notNull: true;
     }>;
     image: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
     name: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: boolean;
     }>;
  };
  dialect: "mysql";
  name: string;
  schema: string | undefined;
}>;

类型声明

columns

columns: {
  email: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  emailVerified: DefaultMyqlColumn<{
     columnType: "MySqlTimestamp";
     data: Date;
     dataType: "date";
     notNull: boolean;
  }>;
  id: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     isPrimaryKey: true;
     notNull: true;
  }>;
  image: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
  name: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: boolean;
  }>;
};

columns.email

email: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.emailVerified

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

columns.id

id: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  isPrimaryKey: true;
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
isPrimaryKey
isPrimaryKey: true;
notNull
notNull: true;

columns.image

image: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.name

name: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

dialect

dialect: "mysql";

name

name: string;

schema

schema: string | undefined;

DefaultMySqlVerificationTokenTable

type DefaultMySqlVerificationTokenTable: MySqlTableWithColumns<{
  columns: {
     expires: DefaultMyqlColumn<{
        columnType: "MySqlTimestamp";
        data: Date;
        dataType: "date";
        notNull: true;
     }>;
     identifier: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
     token: DefaultMyqlColumn<{
        columnType: "MySqlVarChar" | "MySqlText";
        data: string;
        dataType: "string";
        notNull: true;
     }>;
  };
  dialect: "mysql";
  name: string;
  schema: string | undefined;
}>;

类型声明

columns

columns: {
  expires: DefaultMyqlColumn<{
     columnType: "MySqlTimestamp";
     data: Date;
     dataType: "date";
     notNull: true;
  }>;
  identifier: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
  token: DefaultMyqlColumn<{
     columnType: "MySqlVarChar" | "MySqlText";
     data: string;
     dataType: "string";
     notNull: true;
  }>;
};

columns.expires

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

columns.identifier

identifier: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.token

token: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
类型声明
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

dialect

dialect: "mysql";

name

name: string;

schema

schema: string | undefined;

MySqlDrizzleAdapter()

MySqlDrizzleAdapter(client, schema?): Adapter

参数

参数类型
客户端MySqlDatabase<MySqlQueryResultHKT, PreparedQueryHKTBase, any, ExtractTablesWithRelations<any>>
模式?DefaultMySqlSchema

返回值

适配器


defineTables()

defineTables(schema): Required<DefaultMySqlSchema>

参数

参数类型
模式Partial<DefaultMySqlSchema>

返回值

Required<DefaultMySqlSchema>

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