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

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

Type declaration

columns

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

columns.access_token

access_token: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  driverParam: string | number;
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
driverParam
driverParam: string | number;
notNull
notNull: boolean;

columns.expires_at

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

columns.id_token

id_token: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.provider

provider: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
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;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: true;

columns.refresh_token

refresh_token: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.scope

scope: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.session_state

session_state: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.token_type

token_type: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: boolean;
}>;
Type declaration
columnType
columnType: "MySqlVarChar" | "MySqlText";
data
data: string;
dataType
dataType: "string";
notNull
notNull: boolean;

columns.type

type: DefaultMyqlColumn<{
  columnType: "MySqlVarChar" | "MySqlText";
  data: string;
  dataType: "string";
  notNull: true;
}>;
Type declaration
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;
}>;
Type declaration
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;
}>;

Type declaration

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;
}>;
Type declaration
columnType
columnType: "MySqlInt";
data
data: number;
dataType
dataType: "number";
notNull
notNull: true;

columns.credentialBackedUp

credentialBackedUp: DefaultMyqlColumn<{
  columnType: "MySqlBoolean";
  data: boolean;
  dataType: "boolean";
  notNull: true;
}>;
Type declaration
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;
}>;
Type declaration
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;
}>;
Type declaration
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;
}>;
Type declaration
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;
}>;
Type declaration
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;
}>;
Type declaration
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;
}>;
Type declaration
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;
};

Type declaration

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

Type declaration

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

Type declaration

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

Type declaration

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

Parameters

ParameterType
clientMySqlDatabase<MySqlQueryResultHKT, PreparedQueryHKTBase, any, ExtractTablesWithRelations<any>>
schema?DefaultMySqlSchema

Returns

Adapter


defineTables()

defineTables(schema): Required<DefaultMySqlSchema>

Parameters

ParameterType
schemaPartial<DefaultMySqlSchema>

Returns

Required<DefaultMySqlSchema>

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