@auth/drizzle-adapter 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +62 -72
- package/index.d.ts.map +1 -1
- package/index.js +62 -72
- package/lib/mysql.d.ts +230 -70
- package/lib/mysql.d.ts.map +1 -1
- package/lib/mysql.js +17 -21
- package/lib/pg.d.ts +229 -70
- package/lib/pg.d.ts.map +1 -1
- package/lib/pg.js +9 -17
- package/lib/sqlite.d.ts +229 -70
- package/lib/sqlite.d.ts.map +1 -1
- package/lib/sqlite.js +14 -16
- package/lib/utils.d.ts +6 -6
- package/lib/utils.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +62 -88
- package/src/lib/mysql.ts +221 -57
- package/src/lib/pg.ts +213 -51
- package/src/lib/sqlite.ts +215 -47
- package/src/lib/utils.ts +14 -13
package/src/index.ts
CHANGED
|
@@ -26,33 +26,14 @@ import { DefaultSQLiteSchema, SQLiteDrizzleAdapter } from "./lib/sqlite.js"
|
|
|
26
26
|
import { DefaultSchema, SqlFlavorOptions } from "./lib/utils.js"
|
|
27
27
|
|
|
28
28
|
import type { Adapter } from "@auth/core/adapters"
|
|
29
|
-
|
|
30
|
-
export {
|
|
31
|
-
postgresUsersTable,
|
|
32
|
-
postgresAccountsTable,
|
|
33
|
-
postgresSessionsTable,
|
|
34
|
-
postgresVerificationTokensTable,
|
|
35
|
-
} from "./lib/pg.js"
|
|
36
|
-
export {
|
|
37
|
-
sqliteUsersTable,
|
|
38
|
-
sqliteAccountsTable,
|
|
39
|
-
sqliteSessionsTable,
|
|
40
|
-
sqliteVerificationTokensTable,
|
|
41
|
-
} from "./lib/sqlite.js"
|
|
42
|
-
export {
|
|
43
|
-
mysqlUsersTable,
|
|
44
|
-
mysqlAccountsTable,
|
|
45
|
-
mysqlSessionsTable,
|
|
46
|
-
mysqlVerificationTokensTable,
|
|
47
|
-
} from "./lib/mysql.js"
|
|
48
29
|
/**
|
|
49
|
-
* Add this adapter to your `auth.ts` Auth.js configuration object:
|
|
30
|
+
* Create db instance and pass it to adapter. Add this adapter to your `auth.ts` Auth.js configuration object:
|
|
50
31
|
*
|
|
51
32
|
* ```ts title="auth.ts"
|
|
52
33
|
* import NextAuth from "next-auth"
|
|
53
34
|
* import Google from "next-auth/providers/google"
|
|
54
35
|
* import { DrizzleAdapter } from "@auth/drizzle-adapter"
|
|
55
|
-
* import { db } from "./
|
|
36
|
+
* import { db } from "./db.ts"
|
|
56
37
|
*
|
|
57
38
|
* export const { handlers, auth } = NextAuth({
|
|
58
39
|
* adapter: DrizzleAdapter(db),
|
|
@@ -62,15 +43,18 @@ export {
|
|
|
62
43
|
* })
|
|
63
44
|
* ```
|
|
64
45
|
*
|
|
46
|
+
* Follow the Drizzle documentation for [PostgreSQL setup](https://orm.drizzle.team/docs/get-started-postgresql), [MySQL setup](https://orm.drizzle.team/docs/get-started-mysql) and [SQLite setup](https://orm.drizzle.team/docs/get-started-sqlite).
|
|
47
|
+
*
|
|
65
48
|
* :::info
|
|
66
|
-
* If you want to use your own tables, you can pass them as a second argument
|
|
49
|
+
* If you want to use your own tables, you can pass them as a second argument. If you add non-nullable columns, make sure to provide a default value or rewrite functions to handle the missing values.
|
|
67
50
|
* :::
|
|
68
51
|
*
|
|
69
52
|
* ```ts title="auth.ts"
|
|
70
53
|
* import NextAuth from "next-auth"
|
|
71
54
|
* import Google from "next-auth/providers/google"
|
|
72
55
|
* import { DrizzleAdapter } from "@auth/drizzle-adapter"
|
|
73
|
-
* import {
|
|
56
|
+
* import { accounts, sessions, users, verificationTokens } from "./schema"
|
|
57
|
+
* import { db } from "./db.ts"
|
|
74
58
|
*
|
|
75
59
|
* export const { handlers, auth } = NextAuth({
|
|
76
60
|
* adapter: DrizzleAdapter(db, { usersTable: users, accountsTable: accounts, sessionsTable: sessions, verificationTokensTable: verificationTokens }),
|
|
@@ -105,7 +89,7 @@ export {
|
|
|
105
89
|
* export const users = pgTable("user", {
|
|
106
90
|
* id: text("id").primaryKey().$defaultFn(() => randomUUID()),
|
|
107
91
|
* name: text("name"),
|
|
108
|
-
* email: text("email").notNull()
|
|
92
|
+
* email: text("email").notNull(),
|
|
109
93
|
* emailVerified: timestamp("emailVerified", { mode: "date" }),
|
|
110
94
|
* image: text("image"),
|
|
111
95
|
* })
|
|
@@ -128,27 +112,23 @@ export {
|
|
|
128
112
|
* session_state: text("session_state"),
|
|
129
113
|
* },
|
|
130
114
|
* (account) => ({
|
|
131
|
-
* userIdIdx: index().on(account.userId),
|
|
132
115
|
* compoundKey: primaryKey({ columns: [account.provider, account.providerAccountId] }),
|
|
133
116
|
* })
|
|
134
117
|
* )
|
|
135
118
|
*
|
|
136
119
|
* export const sessions = pgTable("session", {
|
|
137
|
-
*
|
|
138
|
-
* sessionToken: text("sessionToken").notNull().unique(),
|
|
120
|
+
* sessionToken: text("sessionToken").primaryKey(),
|
|
139
121
|
* userId: text("userId")
|
|
140
122
|
* .notNull()
|
|
141
123
|
* .references(() => users.id, { onDelete: "cascade" }),
|
|
142
124
|
* expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
143
|
-
* }
|
|
144
|
-
* userIdIdx: index().on(session.userId)
|
|
145
|
-
* }))
|
|
125
|
+
* })
|
|
146
126
|
*
|
|
147
127
|
* export const verificationTokens = pgTable(
|
|
148
128
|
* "verificationToken",
|
|
149
129
|
* {
|
|
150
130
|
* identifier: text("identifier").notNull(),
|
|
151
|
-
* token: text("token").notNull()
|
|
131
|
+
* token: text("token").notNull(),
|
|
152
132
|
* expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
153
133
|
* },
|
|
154
134
|
* (vt) => ({
|
|
@@ -159,6 +139,8 @@ export {
|
|
|
159
139
|
*
|
|
160
140
|
* ### MySQL
|
|
161
141
|
*
|
|
142
|
+
* In MySQL, there's no `returning` clause, so in the `createUser` function, we first insert a new user and then search by `email` to get the user's data. To make the search faster, we suggest adding an index to the `email` column.
|
|
143
|
+
*
|
|
162
144
|
* ```ts title="schema.ts"
|
|
163
145
|
* import {
|
|
164
146
|
* int,
|
|
@@ -172,7 +154,7 @@ export {
|
|
|
172
154
|
* export const users = mysqlTable("user", {
|
|
173
155
|
* id: varchar("id", { length: 255 }).primaryKey().$defaultFn(() => randomUUID()),
|
|
174
156
|
* name: varchar("name", { length: 255 }),
|
|
175
|
-
* email: varchar("email", { length: 255 }).notNull()
|
|
157
|
+
* email: varchar("email", { length: 255 }).notNull(),
|
|
176
158
|
* emailVerified: timestamp("emailVerified", { mode: "date", fsp: 3 }),
|
|
177
159
|
* image: varchar("image", { length: 255 }),
|
|
178
160
|
* })
|
|
@@ -180,49 +162,45 @@ export {
|
|
|
180
162
|
* export const accounts = mysqlTable(
|
|
181
163
|
* "account",
|
|
182
164
|
* {
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
* })
|
|
165
|
+
* userId: varchar("userId", { length: 255 })
|
|
166
|
+
* .notNull()
|
|
167
|
+
* .references(() => users.id, { onDelete: "cascade" }),
|
|
168
|
+
* type: varchar("type", { length: 255 }).notNull(),
|
|
169
|
+
* provider: varchar("provider", { length: 255 }).notNull(),
|
|
170
|
+
* providerAccountId: varchar("providerAccountId", { length: 255 }).notNull(),
|
|
171
|
+
* refresh_token: varchar("refresh_token", { length: 255 }),
|
|
172
|
+
* access_token: varchar("access_token", { length: 255 }),
|
|
173
|
+
* expires_at: int("expires_at"),
|
|
174
|
+
* token_type: varchar("token_type", { length: 255 }),
|
|
175
|
+
* scope: varchar("scope", { length: 255 }),
|
|
176
|
+
* id_token: varchar("id_token", { length: 2048 }),
|
|
177
|
+
* session_state: varchar("session_state", { length: 255 }),
|
|
178
|
+
* },
|
|
179
|
+
* (account) => ({
|
|
180
|
+
* compoundKey: primaryKey({
|
|
181
|
+
columns: [account.provider, account.providerAccountId],
|
|
182
|
+
})
|
|
183
|
+
* })
|
|
203
184
|
* )
|
|
204
185
|
*
|
|
205
186
|
* export const sessions = mysqlTable("session", {
|
|
206
|
-
*
|
|
207
|
-
* sessionToken: varchar("sessionToken", { length: 255 }).notNull().unique(),
|
|
187
|
+
* sessionToken: varchar("sessionToken", { length: 255 }).primaryKey(),
|
|
208
188
|
* userId: varchar("userId", { length: 255 })
|
|
209
189
|
* .notNull()
|
|
210
190
|
* .references(() => users.id, { onDelete: "cascade" }),
|
|
211
191
|
* expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
212
|
-
* }
|
|
213
|
-
* userIdIdx: index('Session_userId_index').on(session.userId)
|
|
214
|
-
* }))
|
|
192
|
+
* })
|
|
215
193
|
*
|
|
216
194
|
* export const verificationTokens = mysqlTable(
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
195
|
+
* "verificationToken",
|
|
196
|
+
* {
|
|
197
|
+
* identifier: varchar("identifier", { length: 255 }).notNull(),
|
|
198
|
+
* token: varchar("token", { length: 255 }).notNull(),
|
|
199
|
+
* expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
200
|
+
* },
|
|
201
|
+
* (vt) => ({
|
|
202
|
+
* compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }),
|
|
203
|
+
* })
|
|
226
204
|
* )
|
|
227
205
|
* ```
|
|
228
206
|
*
|
|
@@ -235,7 +213,7 @@ export {
|
|
|
235
213
|
* export const users = sqliteTable("user", {
|
|
236
214
|
* id: text("id").primaryKey().$defaultFn(() => randomUUID()),
|
|
237
215
|
* name: text("name"),
|
|
238
|
-
* email: text("email").notNull()
|
|
216
|
+
* email: text("email").notNull(),
|
|
239
217
|
* emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
|
|
240
218
|
* image: text("image"),
|
|
241
219
|
* })
|
|
@@ -260,39 +238,35 @@ export {
|
|
|
260
238
|
* (account) => ({
|
|
261
239
|
* compoundKey: primaryKey({
|
|
262
240
|
columns: [account.provider, account.providerAccountId],
|
|
263
|
-
})
|
|
264
|
-
userIdIdx: index('Account_userId_index').on(account.userId)
|
|
241
|
+
})
|
|
265
242
|
* })
|
|
266
243
|
* )
|
|
267
244
|
*
|
|
268
245
|
* export const sessions = sqliteTable("session", {
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
* }, (table) => ({
|
|
276
|
-
* userIdIdx: index('Session_userId_index').on(table.userId)
|
|
277
|
-
* }))
|
|
246
|
+
* sessionToken: text("sessionToken").primaryKey(),
|
|
247
|
+
* userId: text("userId")
|
|
248
|
+
* .notNull()
|
|
249
|
+
* .references(() => users.id, { onDelete: "cascade" }),
|
|
250
|
+
* expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
|
|
251
|
+
* })
|
|
278
252
|
*
|
|
279
253
|
* export const verificationTokens = sqliteTable(
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
254
|
+
* "verificationToken",
|
|
255
|
+
* {
|
|
256
|
+
* identifier: text("identifier").notNull(),
|
|
257
|
+
* token: text("token").notNull(),
|
|
258
|
+
* expires: integer("expires", { mode: "timestamp_ms" }).notNull(),
|
|
259
|
+
* },
|
|
260
|
+
* (vt) => ({
|
|
261
|
+
* compoundKey: primaryKey({ columns: [vt.identifier, vt.token] }),
|
|
262
|
+
* })
|
|
289
263
|
* )
|
|
290
264
|
* ```
|
|
291
265
|
*
|
|
292
266
|
* ## Migrating your database
|
|
293
267
|
* With your schema now described in your code, you'll need to migrate your database to your schema.
|
|
294
268
|
*
|
|
295
|
-
* For full documentation on how to run migrations with Drizzle, [visit the Drizzle documentation](https://orm.drizzle.team/kit-docs/overview#running-migrations).
|
|
269
|
+
* For full documentation on how to run migrations with Drizzle, [visit the Drizzle documentation](https://orm.drizzle.team/kit-docs/overview#running-migrations) or check how to apply changes directly to the database with [push command](https://orm.drizzle.team/kit-docs/overview#prototyping-with-db-push).
|
|
296
270
|
*
|
|
297
271
|
* ---
|
|
298
272
|
*
|
package/src/lib/mysql.ts
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
|
-
import { and, eq } from "drizzle-orm"
|
|
1
|
+
import { and, eq, getTableColumns } from "drizzle-orm"
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
timestamp,
|
|
5
|
-
primaryKey,
|
|
6
|
-
varchar,
|
|
3
|
+
MySqlColumn,
|
|
7
4
|
MySqlDatabase,
|
|
8
|
-
mysqlTable,
|
|
9
5
|
MySqlTableWithColumns,
|
|
10
|
-
TableConfig,
|
|
11
|
-
QueryResultHKT,
|
|
12
6
|
PreparedQueryHKTBase,
|
|
13
|
-
|
|
7
|
+
QueryResultHKT,
|
|
8
|
+
int,
|
|
9
|
+
mysqlTable,
|
|
10
|
+
primaryKey,
|
|
11
|
+
timestamp,
|
|
12
|
+
varchar,
|
|
14
13
|
} from "drizzle-orm/mysql-core"
|
|
15
14
|
|
|
16
15
|
import type {
|
|
17
16
|
Adapter,
|
|
18
|
-
AdapterUser,
|
|
19
17
|
AdapterAccount,
|
|
20
18
|
AdapterSession,
|
|
19
|
+
AdapterUser,
|
|
21
20
|
VerificationToken,
|
|
22
21
|
} from "@auth/core/adapters"
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export const mysqlUsersTable = mysqlTable("user" as string, {
|
|
23
|
+
export const mysqlUsersTable = mysqlTable("user", {
|
|
27
24
|
id: varchar("id", { length: 255 })
|
|
28
25
|
.primaryKey()
|
|
29
|
-
.$defaultFn(() => randomUUID()),
|
|
26
|
+
.$defaultFn(() => crypto.randomUUID()),
|
|
30
27
|
name: varchar("name", { length: 255 }),
|
|
31
|
-
email: varchar("email", { length: 255 }).notNull()
|
|
28
|
+
email: varchar("email", { length: 255 }).notNull(),
|
|
32
29
|
emailVerified: timestamp("emailVerified", { mode: "date", fsp: 3 }),
|
|
33
30
|
image: varchar("image", { length: 255 }),
|
|
34
|
-
})
|
|
31
|
+
}) satisfies DefaultMySqlUsersTable
|
|
35
32
|
|
|
36
33
|
export const mysqlAccountsTable = mysqlTable(
|
|
37
|
-
"account"
|
|
34
|
+
"account",
|
|
38
35
|
{
|
|
39
36
|
userId: varchar("userId", { length: 255 })
|
|
40
37
|
.notNull()
|
|
41
38
|
.references(() => mysqlUsersTable.id, { onDelete: "cascade" }),
|
|
42
|
-
type: varchar("type", { length: 255 })
|
|
39
|
+
type: varchar("type", { length: 255 })
|
|
40
|
+
.$type<AdapterAccount["type"]>()
|
|
41
|
+
.notNull(),
|
|
43
42
|
provider: varchar("provider", { length: 255 }).notNull(),
|
|
44
43
|
providerAccountId: varchar("providerAccountId", { length: 255 }).notNull(),
|
|
45
44
|
refresh_token: varchar("refresh_token", { length: 255 }),
|
|
@@ -54,38 +53,28 @@ export const mysqlAccountsTable = mysqlTable(
|
|
|
54
53
|
compositePk: primaryKey({
|
|
55
54
|
columns: [account.provider, account.providerAccountId],
|
|
56
55
|
}),
|
|
57
|
-
userIdIdx: index("Account_userId_index").on(account.userId),
|
|
58
56
|
})
|
|
59
|
-
)
|
|
57
|
+
) satisfies DefaultMySqlAccountsTable
|
|
60
58
|
|
|
61
|
-
export const mysqlSessionsTable = mysqlTable(
|
|
62
|
-
"
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
userId: varchar("userId", { length: 255 })
|
|
69
|
-
.notNull()
|
|
70
|
-
.references(() => mysqlUsersTable.id, { onDelete: "cascade" }),
|
|
71
|
-
expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
72
|
-
},
|
|
73
|
-
(session) => ({
|
|
74
|
-
userIdIdx: index("Session_userId_index").on(session.userId),
|
|
75
|
-
})
|
|
76
|
-
)
|
|
59
|
+
export const mysqlSessionsTable = mysqlTable("session", {
|
|
60
|
+
sessionToken: varchar("sessionToken", { length: 255 }).primaryKey(),
|
|
61
|
+
userId: varchar("userId", { length: 255 })
|
|
62
|
+
.notNull()
|
|
63
|
+
.references(() => mysqlUsersTable.id, { onDelete: "cascade" }),
|
|
64
|
+
expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
65
|
+
}) satisfies DefaultMySqlSessionsTable
|
|
77
66
|
|
|
78
67
|
export const mysqlVerificationTokensTable = mysqlTable(
|
|
79
|
-
"verificationToken"
|
|
68
|
+
"verificationToken",
|
|
80
69
|
{
|
|
81
70
|
identifier: varchar("identifier", { length: 255 }).notNull(),
|
|
82
|
-
token: varchar("token", { length: 255 }).notNull()
|
|
71
|
+
token: varchar("token", { length: 255 }).notNull(),
|
|
83
72
|
expires: timestamp("expires", { mode: "date" }).notNull(),
|
|
84
73
|
},
|
|
85
74
|
(vt) => ({
|
|
86
75
|
compositePk: primaryKey({ columns: [vt.identifier, vt.token] }),
|
|
87
76
|
})
|
|
88
|
-
)
|
|
77
|
+
) satisfies DefaultMySqlVerificationTokenTable
|
|
89
78
|
|
|
90
79
|
export function MySqlDrizzleAdapter(
|
|
91
80
|
client: MySqlDatabase<QueryResultHKT, PreparedQueryHKTBase, any>,
|
|
@@ -100,15 +89,17 @@ export function MySqlDrizzleAdapter(
|
|
|
100
89
|
schema
|
|
101
90
|
|
|
102
91
|
return {
|
|
103
|
-
async createUser(data:
|
|
104
|
-
const
|
|
92
|
+
async createUser(data: AdapterUser) {
|
|
93
|
+
const hasDefaultId = getTableColumns(usersTable)["id"]["hasDefault"]
|
|
105
94
|
|
|
106
|
-
await client
|
|
95
|
+
await client
|
|
96
|
+
.insert(usersTable)
|
|
97
|
+
.values(hasDefaultId ? data : { ...data, id: crypto.randomUUID() })
|
|
107
98
|
|
|
108
99
|
return client
|
|
109
100
|
.select()
|
|
110
101
|
.from(usersTable)
|
|
111
|
-
.where(eq(usersTable.
|
|
102
|
+
.where(eq(usersTable.email, data.email))
|
|
112
103
|
.then((res) => res[0])
|
|
113
104
|
},
|
|
114
105
|
async getUser(userId: string) {
|
|
@@ -130,14 +121,12 @@ export function MySqlDrizzleAdapter(
|
|
|
130
121
|
userId: string
|
|
131
122
|
expires: Date
|
|
132
123
|
}) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
await client.insert(sessionsTable).values({ ...data, id })
|
|
124
|
+
await client.insert(sessionsTable).values(data)
|
|
136
125
|
|
|
137
126
|
return client
|
|
138
127
|
.select()
|
|
139
128
|
.from(sessionsTable)
|
|
140
|
-
.where(eq(sessionsTable.
|
|
129
|
+
.where(eq(sessionsTable.sessionToken, data.sessionToken))
|
|
141
130
|
.then((res) => res[0])
|
|
142
131
|
},
|
|
143
132
|
async getSessionAndUser(sessionToken: string) {
|
|
@@ -266,18 +255,193 @@ export function MySqlDrizzleAdapter(
|
|
|
266
255
|
}
|
|
267
256
|
}
|
|
268
257
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
258
|
+
type DefaultMyqlColumn<
|
|
259
|
+
T extends {
|
|
260
|
+
data: string | number | Date
|
|
261
|
+
dataType: "string" | "number" | "date"
|
|
262
|
+
notNull: boolean
|
|
263
|
+
columnType: "MySqlVarChar" | "MySqlText" | "MySqlTimestamp" | "MySqlInt"
|
|
264
|
+
},
|
|
265
|
+
> = MySqlColumn<{
|
|
266
|
+
name: string
|
|
267
|
+
columnType: T["columnType"]
|
|
268
|
+
data: T["data"]
|
|
269
|
+
driverParam: string | number
|
|
270
|
+
notNull: T["notNull"]
|
|
271
|
+
hasDefault: boolean
|
|
272
|
+
enumValues: any
|
|
273
|
+
dataType: T["dataType"]
|
|
274
|
+
tableName: string
|
|
275
|
+
}>
|
|
276
|
+
|
|
277
|
+
export type DefaultMySqlUsersTable = MySqlTableWithColumns<{
|
|
278
|
+
name: string
|
|
279
|
+
columns: {
|
|
280
|
+
id: DefaultMyqlColumn<{
|
|
281
|
+
data: string
|
|
282
|
+
dataType: "string"
|
|
283
|
+
notNull: true
|
|
284
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
285
|
+
}>
|
|
286
|
+
name: DefaultMyqlColumn<{
|
|
287
|
+
data: string
|
|
288
|
+
dataType: "string"
|
|
289
|
+
notNull: boolean
|
|
290
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
291
|
+
}>
|
|
292
|
+
email: DefaultMyqlColumn<{
|
|
293
|
+
data: string
|
|
294
|
+
dataType: "string"
|
|
295
|
+
notNull: true
|
|
296
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
297
|
+
}>
|
|
298
|
+
emailVerified: DefaultMyqlColumn<{
|
|
299
|
+
data: Date
|
|
300
|
+
dataType: "date"
|
|
301
|
+
notNull: boolean
|
|
302
|
+
columnType: "MySqlTimestamp"
|
|
303
|
+
}>
|
|
304
|
+
image: DefaultMyqlColumn<{
|
|
305
|
+
data: string
|
|
306
|
+
dataType: "string"
|
|
307
|
+
notNull: boolean
|
|
308
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
309
|
+
}>
|
|
310
|
+
}
|
|
311
|
+
dialect: "mysql"
|
|
312
|
+
schema: string | undefined
|
|
313
|
+
}>
|
|
314
|
+
|
|
315
|
+
export type DefaultMySqlAccountsTable = MySqlTableWithColumns<{
|
|
316
|
+
name: string
|
|
317
|
+
columns: {
|
|
318
|
+
userId: DefaultMyqlColumn<{
|
|
319
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
320
|
+
data: string
|
|
321
|
+
notNull: true
|
|
322
|
+
dataType: "string"
|
|
323
|
+
}>
|
|
324
|
+
type: DefaultMyqlColumn<{
|
|
325
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
326
|
+
data: string
|
|
327
|
+
notNull: true
|
|
328
|
+
dataType: "string"
|
|
329
|
+
}>
|
|
330
|
+
provider: DefaultMyqlColumn<{
|
|
331
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
332
|
+
data: string
|
|
333
|
+
notNull: true
|
|
334
|
+
dataType: "string"
|
|
335
|
+
}>
|
|
336
|
+
providerAccountId: DefaultMyqlColumn<{
|
|
337
|
+
dataType: "string"
|
|
338
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
339
|
+
data: string
|
|
340
|
+
notNull: true
|
|
341
|
+
}>
|
|
342
|
+
refresh_token: DefaultMyqlColumn<{
|
|
343
|
+
dataType: "string"
|
|
344
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
345
|
+
data: string
|
|
346
|
+
notNull: boolean
|
|
347
|
+
}>
|
|
348
|
+
access_token: DefaultMyqlColumn<{
|
|
349
|
+
dataType: "string"
|
|
350
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
351
|
+
data: string
|
|
352
|
+
driverParam: string | number
|
|
353
|
+
notNull: boolean
|
|
354
|
+
}>
|
|
355
|
+
expires_at: DefaultMyqlColumn<{
|
|
356
|
+
dataType: "number"
|
|
357
|
+
columnType: "MySqlInt"
|
|
358
|
+
data: number
|
|
359
|
+
notNull: boolean
|
|
360
|
+
}>
|
|
361
|
+
token_type: DefaultMyqlColumn<{
|
|
362
|
+
dataType: "string"
|
|
363
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
364
|
+
data: string
|
|
365
|
+
notNull: boolean
|
|
366
|
+
}>
|
|
367
|
+
scope: DefaultMyqlColumn<{
|
|
368
|
+
dataType: "string"
|
|
369
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
370
|
+
data: string
|
|
371
|
+
notNull: boolean
|
|
372
|
+
}>
|
|
373
|
+
id_token: DefaultMyqlColumn<{
|
|
374
|
+
dataType: "string"
|
|
375
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
376
|
+
data: string
|
|
377
|
+
notNull: boolean
|
|
378
|
+
}>
|
|
379
|
+
session_state: DefaultMyqlColumn<{
|
|
380
|
+
dataType: "string"
|
|
381
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
382
|
+
data: string
|
|
383
|
+
notNull: boolean
|
|
384
|
+
}>
|
|
385
|
+
}
|
|
386
|
+
dialect: "mysql"
|
|
387
|
+
schema: string | undefined
|
|
388
|
+
}>
|
|
389
|
+
|
|
390
|
+
export type DefaultMySqlSessionsTable = MySqlTableWithColumns<{
|
|
391
|
+
name: string
|
|
392
|
+
columns: {
|
|
393
|
+
sessionToken: DefaultMyqlColumn<{
|
|
394
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
395
|
+
data: string
|
|
396
|
+
notNull: true
|
|
397
|
+
dataType: "string"
|
|
398
|
+
}>
|
|
399
|
+
userId: DefaultMyqlColumn<{
|
|
400
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
401
|
+
data: string
|
|
402
|
+
notNull: true
|
|
403
|
+
dataType: "string"
|
|
404
|
+
}>
|
|
405
|
+
expires: DefaultMyqlColumn<{
|
|
406
|
+
dataType: "date"
|
|
407
|
+
columnType: "MySqlTimestamp"
|
|
408
|
+
data: Date
|
|
409
|
+
notNull: true
|
|
410
|
+
}>
|
|
411
|
+
}
|
|
412
|
+
dialect: "mysql"
|
|
413
|
+
schema: string | undefined
|
|
414
|
+
}>
|
|
415
|
+
|
|
416
|
+
export type DefaultMySqlVerificationTokenTable = MySqlTableWithColumns<{
|
|
417
|
+
name: string
|
|
418
|
+
columns: {
|
|
419
|
+
identifier: DefaultMyqlColumn<{
|
|
420
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
421
|
+
data: string
|
|
422
|
+
notNull: true
|
|
423
|
+
dataType: "string"
|
|
424
|
+
}>
|
|
425
|
+
token: DefaultMyqlColumn<{
|
|
426
|
+
columnType: "MySqlVarChar" | "MySqlText"
|
|
427
|
+
data: string
|
|
428
|
+
notNull: true
|
|
429
|
+
dataType: "string"
|
|
430
|
+
}>
|
|
431
|
+
expires: DefaultMyqlColumn<{
|
|
432
|
+
dataType: "date"
|
|
433
|
+
columnType: "MySqlTimestamp"
|
|
434
|
+
data: Date
|
|
435
|
+
notNull: true
|
|
436
|
+
}>
|
|
437
|
+
}
|
|
438
|
+
dialect: "mysql"
|
|
273
439
|
schema: string | undefined
|
|
274
440
|
}>
|
|
275
441
|
|
|
276
442
|
export type DefaultMySqlSchema = {
|
|
277
|
-
usersTable:
|
|
278
|
-
accountsTable:
|
|
279
|
-
sessionsTable:
|
|
280
|
-
verificationTokensTable:
|
|
281
|
-
(typeof mysqlVerificationTokensTable)["_"]["config"]
|
|
282
|
-
>
|
|
443
|
+
usersTable: DefaultMySqlUsersTable
|
|
444
|
+
accountsTable: DefaultMySqlAccountsTable
|
|
445
|
+
sessionsTable: DefaultMySqlSessionsTable
|
|
446
|
+
verificationTokensTable: DefaultMySqlVerificationTokenTable
|
|
283
447
|
}
|