@auth/drizzle-adapter 0.2.1 → 0.3.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 +9 -9
- package/index.js +9 -9
- package/lib/mysql.d.ts +22 -22
- package/lib/mysql.js +4 -4
- package/lib/pg.d.ts +22 -22
- package/lib/pg.js +4 -4
- package/lib/sqlite.d.ts +22 -22
- package/lib/sqlite.js +4 -4
- package/package.json +3 -3
- package/src/index.ts +9 -9
- package/src/lib/mysql.ts +4 -4
- package/src/lib/pg.ts +4 -4
- package/src/lib/sqlite.ts +4 -4
package/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
62
62
|
* } from "drizzle-orm/pg-core"
|
|
63
63
|
* import type { AdapterAccount } from '@auth/core/adapters'
|
|
64
64
|
*
|
|
65
|
-
* export const users = pgTable("
|
|
65
|
+
* export const users = pgTable("user", {
|
|
66
66
|
* id: text("id").notNull().primaryKey(),
|
|
67
67
|
* name: text("name"),
|
|
68
68
|
* email: text("email").notNull(),
|
|
@@ -71,7 +71,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
71
71
|
* })
|
|
72
72
|
*
|
|
73
73
|
* export const accounts = pgTable(
|
|
74
|
-
* "
|
|
74
|
+
* "account",
|
|
75
75
|
* {
|
|
76
76
|
* userId: text("userId")
|
|
77
77
|
* .notNull()
|
|
@@ -92,7 +92,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
92
92
|
* })
|
|
93
93
|
* )
|
|
94
94
|
*
|
|
95
|
-
* export const sessions = pgTable("
|
|
95
|
+
* export const sessions = pgTable("session", {
|
|
96
96
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
97
97
|
* userId: text("userId")
|
|
98
98
|
* .notNull()
|
|
@@ -125,7 +125,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
125
125
|
* } from "drizzle-orm/mysql-core"
|
|
126
126
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
127
127
|
*
|
|
128
|
-
* export const users = mysqlTable("
|
|
128
|
+
* export const users = mysqlTable("user", {
|
|
129
129
|
* id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
130
130
|
* name: varchar("name", { length: 255 }),
|
|
131
131
|
* email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -134,7 +134,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
134
134
|
* })
|
|
135
135
|
*
|
|
136
136
|
* export const accounts = mysqlTable(
|
|
137
|
-
* "
|
|
137
|
+
* "account",
|
|
138
138
|
* {
|
|
139
139
|
* userId: varchar("userId", { length: 255 })
|
|
140
140
|
* .notNull()
|
|
@@ -155,7 +155,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
155
155
|
* })
|
|
156
156
|
* )
|
|
157
157
|
*
|
|
158
|
-
* export const sessions = mysqlTable("
|
|
158
|
+
* export const sessions = mysqlTable("session", {
|
|
159
159
|
* sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
|
|
160
160
|
* userId: varchar("userId", { length: 255 })
|
|
161
161
|
* .notNull()
|
|
@@ -182,7 +182,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
182
182
|
* import { integer, sqliteTable, text, primaryKey } from "drizzle-orm/sqlite-core"
|
|
183
183
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
184
184
|
*
|
|
185
|
-
* export const users = sqliteTable("
|
|
185
|
+
* export const users = sqliteTable("user", {
|
|
186
186
|
* id: text("id").notNull().primaryKey(),
|
|
187
187
|
* name: text("name"),
|
|
188
188
|
* email: text("email").notNull(),
|
|
@@ -191,7 +191,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
191
191
|
* })
|
|
192
192
|
*
|
|
193
193
|
* export const accounts = sqliteTable(
|
|
194
|
-
* "
|
|
194
|
+
* "account",
|
|
195
195
|
* {
|
|
196
196
|
* userId: text("userId")
|
|
197
197
|
* .notNull()
|
|
@@ -212,7 +212,7 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
212
212
|
* })
|
|
213
213
|
* )
|
|
214
214
|
*
|
|
215
|
-
* export const sessions = sqliteTable("
|
|
215
|
+
* export const sessions = sqliteTable("session", {
|
|
216
216
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
217
217
|
* userId: text("userId")
|
|
218
218
|
* .notNull()
|
package/index.js
CHANGED
|
@@ -64,7 +64,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
64
64
|
* } from "drizzle-orm/pg-core"
|
|
65
65
|
* import type { AdapterAccount } from '@auth/core/adapters'
|
|
66
66
|
*
|
|
67
|
-
* export const users = pgTable("
|
|
67
|
+
* export const users = pgTable("user", {
|
|
68
68
|
* id: text("id").notNull().primaryKey(),
|
|
69
69
|
* name: text("name"),
|
|
70
70
|
* email: text("email").notNull(),
|
|
@@ -73,7 +73,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
73
73
|
* })
|
|
74
74
|
*
|
|
75
75
|
* export const accounts = pgTable(
|
|
76
|
-
* "
|
|
76
|
+
* "account",
|
|
77
77
|
* {
|
|
78
78
|
* userId: text("userId")
|
|
79
79
|
* .notNull()
|
|
@@ -94,7 +94,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
94
94
|
* })
|
|
95
95
|
* )
|
|
96
96
|
*
|
|
97
|
-
* export const sessions = pgTable("
|
|
97
|
+
* export const sessions = pgTable("session", {
|
|
98
98
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
99
99
|
* userId: text("userId")
|
|
100
100
|
* .notNull()
|
|
@@ -127,7 +127,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
127
127
|
* } from "drizzle-orm/mysql-core"
|
|
128
128
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
129
129
|
*
|
|
130
|
-
* export const users = mysqlTable("
|
|
130
|
+
* export const users = mysqlTable("user", {
|
|
131
131
|
* id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
132
132
|
* name: varchar("name", { length: 255 }),
|
|
133
133
|
* email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -136,7 +136,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
136
136
|
* })
|
|
137
137
|
*
|
|
138
138
|
* export const accounts = mysqlTable(
|
|
139
|
-
* "
|
|
139
|
+
* "account",
|
|
140
140
|
* {
|
|
141
141
|
* userId: varchar("userId", { length: 255 })
|
|
142
142
|
* .notNull()
|
|
@@ -157,7 +157,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
157
157
|
* })
|
|
158
158
|
* )
|
|
159
159
|
*
|
|
160
|
-
* export const sessions = mysqlTable("
|
|
160
|
+
* export const sessions = mysqlTable("session", {
|
|
161
161
|
* sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
|
|
162
162
|
* userId: varchar("userId", { length: 255 })
|
|
163
163
|
* .notNull()
|
|
@@ -184,7 +184,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
184
184
|
* import { integer, sqliteTable, text, primaryKey } from "drizzle-orm/sqlite-core"
|
|
185
185
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
186
186
|
*
|
|
187
|
-
* export const users = sqliteTable("
|
|
187
|
+
* export const users = sqliteTable("user", {
|
|
188
188
|
* id: text("id").notNull().primaryKey(),
|
|
189
189
|
* name: text("name"),
|
|
190
190
|
* email: text("email").notNull(),
|
|
@@ -193,7 +193,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
193
193
|
* })
|
|
194
194
|
*
|
|
195
195
|
* export const accounts = sqliteTable(
|
|
196
|
-
* "
|
|
196
|
+
* "account",
|
|
197
197
|
* {
|
|
198
198
|
* userId: text("userId")
|
|
199
199
|
* .notNull()
|
|
@@ -214,7 +214,7 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
|
|
|
214
214
|
* })
|
|
215
215
|
* )
|
|
216
216
|
*
|
|
217
|
-
* export const sessions = sqliteTable("
|
|
217
|
+
* export const sessions = sqliteTable("session", {
|
|
218
218
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
219
219
|
* userId: text("userId")
|
|
220
220
|
* .notNull()
|
package/lib/mysql.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { Adapter } from "@auth/core/adapters";
|
|
|
3
3
|
import type { MySql2Database } from "drizzle-orm/mysql2";
|
|
4
4
|
export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
5
5
|
users: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
6
|
-
name: "
|
|
6
|
+
name: "user";
|
|
7
7
|
schema: undefined;
|
|
8
8
|
columns: {
|
|
9
9
|
id: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
10
|
-
tableName: "
|
|
10
|
+
tableName: "user";
|
|
11
11
|
enumValues: [string, ...string[]];
|
|
12
12
|
name: "id";
|
|
13
13
|
data: string;
|
|
@@ -16,7 +16,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
16
16
|
notNull: true;
|
|
17
17
|
}>;
|
|
18
18
|
name: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
19
|
-
tableName: "
|
|
19
|
+
tableName: "user";
|
|
20
20
|
name: "name";
|
|
21
21
|
data: string;
|
|
22
22
|
driverParam: string | number;
|
|
@@ -25,7 +25,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
25
25
|
hasDefault: false;
|
|
26
26
|
}>;
|
|
27
27
|
email: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
28
|
-
tableName: "
|
|
28
|
+
tableName: "user";
|
|
29
29
|
enumValues: [string, ...string[]];
|
|
30
30
|
name: "email";
|
|
31
31
|
data: string;
|
|
@@ -34,7 +34,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
34
34
|
notNull: true;
|
|
35
35
|
}>;
|
|
36
36
|
emailVerified: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
37
|
-
tableName: "
|
|
37
|
+
tableName: "user";
|
|
38
38
|
name: "emailVerified";
|
|
39
39
|
data: Date;
|
|
40
40
|
driverParam: string | number;
|
|
@@ -42,7 +42,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
42
42
|
hasDefault: true;
|
|
43
43
|
}>;
|
|
44
44
|
image: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
45
|
-
tableName: "
|
|
45
|
+
tableName: "user";
|
|
46
46
|
name: "image";
|
|
47
47
|
data: string;
|
|
48
48
|
driverParam: string | number;
|
|
@@ -53,11 +53,11 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
53
53
|
};
|
|
54
54
|
}>;
|
|
55
55
|
accounts: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
56
|
-
name: "
|
|
56
|
+
name: "account";
|
|
57
57
|
schema: undefined;
|
|
58
58
|
columns: {
|
|
59
59
|
userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
60
|
-
tableName: "
|
|
60
|
+
tableName: "account";
|
|
61
61
|
enumValues: [string, ...string[]];
|
|
62
62
|
name: "userId";
|
|
63
63
|
data: string;
|
|
@@ -66,7 +66,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
66
66
|
notNull: true;
|
|
67
67
|
}>;
|
|
68
68
|
type: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
69
|
-
tableName: "
|
|
69
|
+
tableName: "account";
|
|
70
70
|
enumValues: [string, ...string[]];
|
|
71
71
|
name: "type";
|
|
72
72
|
data: "email" | "oidc" | "oauth";
|
|
@@ -75,7 +75,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
75
75
|
notNull: true;
|
|
76
76
|
}>;
|
|
77
77
|
provider: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
78
|
-
tableName: "
|
|
78
|
+
tableName: "account";
|
|
79
79
|
enumValues: [string, ...string[]];
|
|
80
80
|
name: "provider";
|
|
81
81
|
data: string;
|
|
@@ -84,7 +84,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
84
84
|
notNull: true;
|
|
85
85
|
}>;
|
|
86
86
|
providerAccountId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
87
|
-
tableName: "
|
|
87
|
+
tableName: "account";
|
|
88
88
|
enumValues: [string, ...string[]];
|
|
89
89
|
name: "providerAccountId";
|
|
90
90
|
data: string;
|
|
@@ -93,7 +93,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
93
93
|
notNull: true;
|
|
94
94
|
}>;
|
|
95
95
|
refresh_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
96
|
-
tableName: "
|
|
96
|
+
tableName: "account";
|
|
97
97
|
name: "refresh_token";
|
|
98
98
|
data: string;
|
|
99
99
|
driverParam: string | number;
|
|
@@ -102,7 +102,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
102
102
|
hasDefault: false;
|
|
103
103
|
}>;
|
|
104
104
|
access_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
105
|
-
tableName: "
|
|
105
|
+
tableName: "account";
|
|
106
106
|
name: "access_token";
|
|
107
107
|
data: string;
|
|
108
108
|
driverParam: string | number;
|
|
@@ -111,7 +111,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
111
111
|
hasDefault: false;
|
|
112
112
|
}>;
|
|
113
113
|
expires_at: import("drizzle-orm/mysql-core").MySqlInt<{
|
|
114
|
-
tableName: "
|
|
114
|
+
tableName: "account";
|
|
115
115
|
name: "expires_at";
|
|
116
116
|
data: number;
|
|
117
117
|
driverParam: string | number;
|
|
@@ -119,7 +119,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
119
119
|
hasDefault: false;
|
|
120
120
|
}>;
|
|
121
121
|
token_type: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
122
|
-
tableName: "
|
|
122
|
+
tableName: "account";
|
|
123
123
|
name: "token_type";
|
|
124
124
|
data: string;
|
|
125
125
|
driverParam: string | number;
|
|
@@ -128,7 +128,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
128
128
|
hasDefault: false;
|
|
129
129
|
}>;
|
|
130
130
|
scope: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
131
|
-
tableName: "
|
|
131
|
+
tableName: "account";
|
|
132
132
|
name: "scope";
|
|
133
133
|
data: string;
|
|
134
134
|
driverParam: string | number;
|
|
@@ -137,7 +137,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
137
137
|
hasDefault: false;
|
|
138
138
|
}>;
|
|
139
139
|
id_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
140
|
-
tableName: "
|
|
140
|
+
tableName: "account";
|
|
141
141
|
name: "id_token";
|
|
142
142
|
data: string;
|
|
143
143
|
driverParam: string | number;
|
|
@@ -146,7 +146,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
146
146
|
hasDefault: false;
|
|
147
147
|
}>;
|
|
148
148
|
session_state: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
149
|
-
tableName: "
|
|
149
|
+
tableName: "account";
|
|
150
150
|
name: "session_state";
|
|
151
151
|
data: string;
|
|
152
152
|
driverParam: string | number;
|
|
@@ -157,11 +157,11 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
157
157
|
};
|
|
158
158
|
}>;
|
|
159
159
|
sessions: import("drizzle-orm/select.types.d-b947a018").aw<{
|
|
160
|
-
name: "
|
|
160
|
+
name: "session";
|
|
161
161
|
schema: undefined;
|
|
162
162
|
columns: {
|
|
163
163
|
sessionToken: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
164
|
-
tableName: "
|
|
164
|
+
tableName: "session";
|
|
165
165
|
enumValues: [string, ...string[]];
|
|
166
166
|
name: "sessionToken";
|
|
167
167
|
data: string;
|
|
@@ -170,7 +170,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
170
170
|
notNull: true;
|
|
171
171
|
}>;
|
|
172
172
|
userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
|
|
173
|
-
tableName: "
|
|
173
|
+
tableName: "session";
|
|
174
174
|
enumValues: [string, ...string[]];
|
|
175
175
|
name: "userId";
|
|
176
176
|
data: string;
|
|
@@ -179,7 +179,7 @@ export declare function createTables(mySqlTable: MySqlTableFn): {
|
|
|
179
179
|
notNull: true;
|
|
180
180
|
}>;
|
|
181
181
|
expires: import("drizzle-orm/mysql-core").MySqlTimestamp<{
|
|
182
|
-
tableName: "
|
|
182
|
+
tableName: "session";
|
|
183
183
|
name: "expires";
|
|
184
184
|
data: Date;
|
|
185
185
|
driverParam: string | number;
|
package/lib/mysql.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { and, eq } from "drizzle-orm";
|
|
2
2
|
import { int, timestamp, mysqlTable as defaultMySqlTableFn, primaryKey, varchar, } from "drizzle-orm/mysql-core";
|
|
3
3
|
export function createTables(mySqlTable) {
|
|
4
|
-
const users = mySqlTable("
|
|
4
|
+
const users = mySqlTable("user", {
|
|
5
5
|
id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
6
6
|
name: varchar("name", { length: 255 }),
|
|
7
7
|
email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -11,7 +11,7 @@ export function createTables(mySqlTable) {
|
|
|
11
11
|
}).defaultNow(),
|
|
12
12
|
image: varchar("image", { length: 255 }),
|
|
13
13
|
});
|
|
14
|
-
const accounts = mySqlTable("
|
|
14
|
+
const accounts = mySqlTable("account", {
|
|
15
15
|
userId: varchar("userId", { length: 255 })
|
|
16
16
|
.notNull()
|
|
17
17
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
@@ -32,7 +32,7 @@ export function createTables(mySqlTable) {
|
|
|
32
32
|
}, (account) => ({
|
|
33
33
|
compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
34
34
|
}));
|
|
35
|
-
const sessions = mySqlTable("
|
|
35
|
+
const sessions = mySqlTable("session", {
|
|
36
36
|
sessionToken: varchar("sessionToken", { length: 255 })
|
|
37
37
|
.notNull()
|
|
38
38
|
.primaryKey(),
|
|
@@ -136,7 +136,7 @@ export function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
|
|
|
136
136
|
if (!dbAccount) {
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
139
|
-
return dbAccount.
|
|
139
|
+
return dbAccount.user;
|
|
140
140
|
},
|
|
141
141
|
async deleteSession(sessionToken) {
|
|
142
142
|
const session = (await client
|
package/lib/pg.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
|
3
3
|
import type { Adapter } from "@auth/core/adapters";
|
|
4
4
|
export declare function createTables(pgTable: PgTableFn): {
|
|
5
5
|
users: import("drizzle-orm/db.d-b9835153").az<{
|
|
6
|
-
name: "
|
|
6
|
+
name: "user";
|
|
7
7
|
schema: undefined;
|
|
8
8
|
columns: {
|
|
9
9
|
id: import("drizzle-orm/pg-core").PgText<{
|
|
10
|
-
tableName: "
|
|
10
|
+
tableName: "user";
|
|
11
11
|
enumValues: [string, ...string[]];
|
|
12
12
|
name: "id";
|
|
13
13
|
data: string;
|
|
@@ -16,7 +16,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
16
16
|
notNull: true;
|
|
17
17
|
}>;
|
|
18
18
|
name: import("drizzle-orm/pg-core").PgText<{
|
|
19
|
-
tableName: "
|
|
19
|
+
tableName: "user";
|
|
20
20
|
name: "name";
|
|
21
21
|
data: string;
|
|
22
22
|
enumValues: [string, ...string[]];
|
|
@@ -25,7 +25,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
25
25
|
hasDefault: false;
|
|
26
26
|
}>;
|
|
27
27
|
email: import("drizzle-orm/pg-core").PgText<{
|
|
28
|
-
tableName: "
|
|
28
|
+
tableName: "user";
|
|
29
29
|
enumValues: [string, ...string[]];
|
|
30
30
|
name: "email";
|
|
31
31
|
data: string;
|
|
@@ -34,7 +34,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
34
34
|
notNull: true;
|
|
35
35
|
}>;
|
|
36
36
|
emailVerified: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
37
|
-
tableName: "
|
|
37
|
+
tableName: "user";
|
|
38
38
|
name: "emailVerified";
|
|
39
39
|
data: Date;
|
|
40
40
|
driverParam: string;
|
|
@@ -42,7 +42,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
42
42
|
hasDefault: false;
|
|
43
43
|
}>;
|
|
44
44
|
image: import("drizzle-orm/pg-core").PgText<{
|
|
45
|
-
tableName: "
|
|
45
|
+
tableName: "user";
|
|
46
46
|
name: "image";
|
|
47
47
|
data: string;
|
|
48
48
|
enumValues: [string, ...string[]];
|
|
@@ -53,11 +53,11 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
53
53
|
};
|
|
54
54
|
}>;
|
|
55
55
|
accounts: import("drizzle-orm/db.d-b9835153").az<{
|
|
56
|
-
name: "
|
|
56
|
+
name: "account";
|
|
57
57
|
schema: undefined;
|
|
58
58
|
columns: {
|
|
59
59
|
userId: import("drizzle-orm/pg-core").PgText<{
|
|
60
|
-
tableName: "
|
|
60
|
+
tableName: "account";
|
|
61
61
|
enumValues: [string, ...string[]];
|
|
62
62
|
name: "userId";
|
|
63
63
|
data: string;
|
|
@@ -66,7 +66,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
66
66
|
notNull: true;
|
|
67
67
|
}>;
|
|
68
68
|
type: import("drizzle-orm/pg-core").PgText<{
|
|
69
|
-
tableName: "
|
|
69
|
+
tableName: "account";
|
|
70
70
|
enumValues: [string, ...string[]];
|
|
71
71
|
name: "type";
|
|
72
72
|
data: "email" | "oidc" | "oauth";
|
|
@@ -75,7 +75,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
75
75
|
notNull: true;
|
|
76
76
|
}>;
|
|
77
77
|
provider: import("drizzle-orm/pg-core").PgText<{
|
|
78
|
-
tableName: "
|
|
78
|
+
tableName: "account";
|
|
79
79
|
enumValues: [string, ...string[]];
|
|
80
80
|
name: "provider";
|
|
81
81
|
data: string;
|
|
@@ -84,7 +84,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
84
84
|
notNull: true;
|
|
85
85
|
}>;
|
|
86
86
|
providerAccountId: import("drizzle-orm/pg-core").PgText<{
|
|
87
|
-
tableName: "
|
|
87
|
+
tableName: "account";
|
|
88
88
|
enumValues: [string, ...string[]];
|
|
89
89
|
name: "providerAccountId";
|
|
90
90
|
data: string;
|
|
@@ -93,7 +93,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
93
93
|
notNull: true;
|
|
94
94
|
}>;
|
|
95
95
|
refresh_token: import("drizzle-orm/pg-core").PgText<{
|
|
96
|
-
tableName: "
|
|
96
|
+
tableName: "account";
|
|
97
97
|
name: "refresh_token";
|
|
98
98
|
data: string;
|
|
99
99
|
enumValues: [string, ...string[]];
|
|
@@ -102,7 +102,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
102
102
|
hasDefault: false;
|
|
103
103
|
}>;
|
|
104
104
|
access_token: import("drizzle-orm/pg-core").PgText<{
|
|
105
|
-
tableName: "
|
|
105
|
+
tableName: "account";
|
|
106
106
|
name: "access_token";
|
|
107
107
|
data: string;
|
|
108
108
|
enumValues: [string, ...string[]];
|
|
@@ -111,7 +111,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
111
111
|
hasDefault: false;
|
|
112
112
|
}>;
|
|
113
113
|
expires_at: import("drizzle-orm/pg-core").PgInteger<{
|
|
114
|
-
tableName: "
|
|
114
|
+
tableName: "account";
|
|
115
115
|
name: "expires_at";
|
|
116
116
|
data: number;
|
|
117
117
|
driverParam: string | number;
|
|
@@ -119,7 +119,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
119
119
|
notNull: false;
|
|
120
120
|
}>;
|
|
121
121
|
token_type: import("drizzle-orm/pg-core").PgText<{
|
|
122
|
-
tableName: "
|
|
122
|
+
tableName: "account";
|
|
123
123
|
name: "token_type";
|
|
124
124
|
data: string;
|
|
125
125
|
enumValues: [string, ...string[]];
|
|
@@ -128,7 +128,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
128
128
|
hasDefault: false;
|
|
129
129
|
}>;
|
|
130
130
|
scope: import("drizzle-orm/pg-core").PgText<{
|
|
131
|
-
tableName: "
|
|
131
|
+
tableName: "account";
|
|
132
132
|
name: "scope";
|
|
133
133
|
data: string;
|
|
134
134
|
enumValues: [string, ...string[]];
|
|
@@ -137,7 +137,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
137
137
|
hasDefault: false;
|
|
138
138
|
}>;
|
|
139
139
|
id_token: import("drizzle-orm/pg-core").PgText<{
|
|
140
|
-
tableName: "
|
|
140
|
+
tableName: "account";
|
|
141
141
|
name: "id_token";
|
|
142
142
|
data: string;
|
|
143
143
|
enumValues: [string, ...string[]];
|
|
@@ -146,7 +146,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
146
146
|
hasDefault: false;
|
|
147
147
|
}>;
|
|
148
148
|
session_state: import("drizzle-orm/pg-core").PgText<{
|
|
149
|
-
tableName: "
|
|
149
|
+
tableName: "account";
|
|
150
150
|
name: "session_state";
|
|
151
151
|
data: string;
|
|
152
152
|
enumValues: [string, ...string[]];
|
|
@@ -157,11 +157,11 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
157
157
|
};
|
|
158
158
|
}>;
|
|
159
159
|
sessions: import("drizzle-orm/db.d-b9835153").az<{
|
|
160
|
-
name: "
|
|
160
|
+
name: "session";
|
|
161
161
|
schema: undefined;
|
|
162
162
|
columns: {
|
|
163
163
|
sessionToken: import("drizzle-orm/pg-core").PgText<{
|
|
164
|
-
tableName: "
|
|
164
|
+
tableName: "session";
|
|
165
165
|
enumValues: [string, ...string[]];
|
|
166
166
|
name: "sessionToken";
|
|
167
167
|
data: string;
|
|
@@ -170,7 +170,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
170
170
|
notNull: true;
|
|
171
171
|
}>;
|
|
172
172
|
userId: import("drizzle-orm/pg-core").PgText<{
|
|
173
|
-
tableName: "
|
|
173
|
+
tableName: "session";
|
|
174
174
|
enumValues: [string, ...string[]];
|
|
175
175
|
name: "userId";
|
|
176
176
|
data: string;
|
|
@@ -179,7 +179,7 @@ export declare function createTables(pgTable: PgTableFn): {
|
|
|
179
179
|
notNull: true;
|
|
180
180
|
}>;
|
|
181
181
|
expires: import("drizzle-orm/pg-core").PgTimestamp<{
|
|
182
|
-
tableName: "
|
|
182
|
+
tableName: "session";
|
|
183
183
|
name: "expires";
|
|
184
184
|
data: Date;
|
|
185
185
|
driverParam: string;
|
package/lib/pg.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { and, eq } from "drizzle-orm";
|
|
2
2
|
import { timestamp, pgTable as defaultPgTableFn, text, primaryKey, integer, } from "drizzle-orm/pg-core";
|
|
3
3
|
export function createTables(pgTable) {
|
|
4
|
-
const users = pgTable("
|
|
4
|
+
const users = pgTable("user", {
|
|
5
5
|
id: text("id").notNull().primaryKey(),
|
|
6
6
|
name: text("name"),
|
|
7
7
|
email: text("email").notNull(),
|
|
8
8
|
emailVerified: timestamp("emailVerified", { mode: "date" }),
|
|
9
9
|
image: text("image"),
|
|
10
10
|
});
|
|
11
|
-
const accounts = pgTable("
|
|
11
|
+
const accounts = pgTable("account", {
|
|
12
12
|
userId: text("userId")
|
|
13
13
|
.notNull()
|
|
14
14
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
@@ -25,7 +25,7 @@ export function createTables(pgTable) {
|
|
|
25
25
|
}, (account) => ({
|
|
26
26
|
compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
27
27
|
}));
|
|
28
|
-
const sessions = pgTable("
|
|
28
|
+
const sessions = pgTable("session", {
|
|
29
29
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
30
30
|
userId: text("userId")
|
|
31
31
|
.notNull()
|
|
@@ -132,7 +132,7 @@ export function pgDrizzleAdapter(client, tableFn = defaultPgTableFn) {
|
|
|
132
132
|
if (!dbAccount) {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
135
|
-
return dbAccount.
|
|
135
|
+
return dbAccount.user;
|
|
136
136
|
},
|
|
137
137
|
async deleteSession(sessionToken) {
|
|
138
138
|
const session = await client
|
package/lib/sqlite.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { BaseSQLiteDatabase, SQLiteTableFn } from "drizzle-orm/sqlite-core";
|
|
|
2
2
|
import type { Adapter } from "@auth/core/adapters";
|
|
3
3
|
export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
4
4
|
users: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
5
|
-
name: "
|
|
5
|
+
name: "user";
|
|
6
6
|
schema: undefined;
|
|
7
7
|
columns: {
|
|
8
8
|
id: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
9
|
-
tableName: "
|
|
9
|
+
tableName: "user";
|
|
10
10
|
enumValues: [string, ...string[]];
|
|
11
11
|
name: "id";
|
|
12
12
|
data: string;
|
|
@@ -15,7 +15,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
15
15
|
notNull: true;
|
|
16
16
|
}>;
|
|
17
17
|
name: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
18
|
-
tableName: "
|
|
18
|
+
tableName: "user";
|
|
19
19
|
name: "name";
|
|
20
20
|
data: string;
|
|
21
21
|
driverParam: string;
|
|
@@ -24,7 +24,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
24
24
|
hasDefault: false;
|
|
25
25
|
}>;
|
|
26
26
|
email: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
27
|
-
tableName: "
|
|
27
|
+
tableName: "user";
|
|
28
28
|
enumValues: [string, ...string[]];
|
|
29
29
|
name: "email";
|
|
30
30
|
data: string;
|
|
@@ -33,7 +33,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
33
33
|
notNull: true;
|
|
34
34
|
}>;
|
|
35
35
|
emailVerified: import("drizzle-orm/sqlite-core").SQLiteTimestamp<{
|
|
36
|
-
tableName: "
|
|
36
|
+
tableName: "user";
|
|
37
37
|
name: "emailVerified";
|
|
38
38
|
data: Date;
|
|
39
39
|
driverParam: number;
|
|
@@ -41,7 +41,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
41
41
|
hasDefault: false;
|
|
42
42
|
}>;
|
|
43
43
|
image: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
44
|
-
tableName: "
|
|
44
|
+
tableName: "user";
|
|
45
45
|
name: "image";
|
|
46
46
|
data: string;
|
|
47
47
|
driverParam: string;
|
|
@@ -52,11 +52,11 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
52
52
|
};
|
|
53
53
|
}>;
|
|
54
54
|
accounts: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
55
|
-
name: "
|
|
55
|
+
name: "account";
|
|
56
56
|
schema: undefined;
|
|
57
57
|
columns: {
|
|
58
58
|
userId: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
59
|
-
tableName: "
|
|
59
|
+
tableName: "account";
|
|
60
60
|
enumValues: [string, ...string[]];
|
|
61
61
|
name: "userId";
|
|
62
62
|
data: string;
|
|
@@ -65,7 +65,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
65
65
|
notNull: true;
|
|
66
66
|
}>;
|
|
67
67
|
type: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
68
|
-
tableName: "
|
|
68
|
+
tableName: "account";
|
|
69
69
|
enumValues: [string, ...string[]];
|
|
70
70
|
name: "type";
|
|
71
71
|
data: "email" | "oidc" | "oauth";
|
|
@@ -74,7 +74,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
74
74
|
notNull: true;
|
|
75
75
|
}>;
|
|
76
76
|
provider: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
77
|
-
tableName: "
|
|
77
|
+
tableName: "account";
|
|
78
78
|
enumValues: [string, ...string[]];
|
|
79
79
|
name: "provider";
|
|
80
80
|
data: string;
|
|
@@ -83,7 +83,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
83
83
|
notNull: true;
|
|
84
84
|
}>;
|
|
85
85
|
providerAccountId: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
86
|
-
tableName: "
|
|
86
|
+
tableName: "account";
|
|
87
87
|
enumValues: [string, ...string[]];
|
|
88
88
|
name: "providerAccountId";
|
|
89
89
|
data: string;
|
|
@@ -92,7 +92,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
92
92
|
notNull: true;
|
|
93
93
|
}>;
|
|
94
94
|
refresh_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
95
|
-
tableName: "
|
|
95
|
+
tableName: "account";
|
|
96
96
|
name: "refresh_token";
|
|
97
97
|
data: string;
|
|
98
98
|
driverParam: string;
|
|
@@ -101,7 +101,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
101
101
|
hasDefault: false;
|
|
102
102
|
}>;
|
|
103
103
|
access_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
104
|
-
tableName: "
|
|
104
|
+
tableName: "account";
|
|
105
105
|
name: "access_token";
|
|
106
106
|
data: string;
|
|
107
107
|
driverParam: string;
|
|
@@ -110,7 +110,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
110
110
|
hasDefault: false;
|
|
111
111
|
}>;
|
|
112
112
|
expires_at: import("drizzle-orm/sqlite-core").SQLiteInteger<{
|
|
113
|
-
tableName: "
|
|
113
|
+
tableName: "account";
|
|
114
114
|
name: "expires_at";
|
|
115
115
|
data: number;
|
|
116
116
|
driverParam: number;
|
|
@@ -118,7 +118,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
118
118
|
hasDefault: false;
|
|
119
119
|
}>;
|
|
120
120
|
token_type: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
121
|
-
tableName: "
|
|
121
|
+
tableName: "account";
|
|
122
122
|
name: "token_type";
|
|
123
123
|
data: string;
|
|
124
124
|
driverParam: string;
|
|
@@ -127,7 +127,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
127
127
|
hasDefault: false;
|
|
128
128
|
}>;
|
|
129
129
|
scope: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
130
|
-
tableName: "
|
|
130
|
+
tableName: "account";
|
|
131
131
|
name: "scope";
|
|
132
132
|
data: string;
|
|
133
133
|
driverParam: string;
|
|
@@ -136,7 +136,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
136
136
|
hasDefault: false;
|
|
137
137
|
}>;
|
|
138
138
|
id_token: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
139
|
-
tableName: "
|
|
139
|
+
tableName: "account";
|
|
140
140
|
name: "id_token";
|
|
141
141
|
data: string;
|
|
142
142
|
driverParam: string;
|
|
@@ -145,7 +145,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
145
145
|
hasDefault: false;
|
|
146
146
|
}>;
|
|
147
147
|
session_state: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
148
|
-
tableName: "
|
|
148
|
+
tableName: "account";
|
|
149
149
|
name: "session_state";
|
|
150
150
|
data: string;
|
|
151
151
|
driverParam: string;
|
|
@@ -156,11 +156,11 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
156
156
|
};
|
|
157
157
|
}>;
|
|
158
158
|
sessions: import("drizzle-orm/db.d-b5fdf746").ag<{
|
|
159
|
-
name: "
|
|
159
|
+
name: "session";
|
|
160
160
|
schema: undefined;
|
|
161
161
|
columns: {
|
|
162
162
|
sessionToken: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
163
|
-
tableName: "
|
|
163
|
+
tableName: "session";
|
|
164
164
|
enumValues: [string, ...string[]];
|
|
165
165
|
name: "sessionToken";
|
|
166
166
|
data: string;
|
|
@@ -169,7 +169,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
169
169
|
notNull: true;
|
|
170
170
|
}>;
|
|
171
171
|
userId: import("drizzle-orm/sqlite-core").SQLiteText<{
|
|
172
|
-
tableName: "
|
|
172
|
+
tableName: "session";
|
|
173
173
|
enumValues: [string, ...string[]];
|
|
174
174
|
name: "userId";
|
|
175
175
|
data: string;
|
|
@@ -178,7 +178,7 @@ export declare function createTables(sqliteTable: SQLiteTableFn): {
|
|
|
178
178
|
notNull: true;
|
|
179
179
|
}>;
|
|
180
180
|
expires: import("drizzle-orm/sqlite-core").SQLiteTimestamp<{
|
|
181
|
-
tableName: "
|
|
181
|
+
tableName: "session";
|
|
182
182
|
name: "expires";
|
|
183
183
|
data: Date;
|
|
184
184
|
driverParam: number;
|
package/lib/sqlite.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { eq, and } from "drizzle-orm";
|
|
2
2
|
import { integer, sqliteTable as defaultSqliteTableFn, text, primaryKey, } from "drizzle-orm/sqlite-core";
|
|
3
3
|
export function createTables(sqliteTable) {
|
|
4
|
-
const users = sqliteTable("
|
|
4
|
+
const users = sqliteTable("user", {
|
|
5
5
|
id: text("id").notNull().primaryKey(),
|
|
6
6
|
name: text("name"),
|
|
7
7
|
email: text("email").notNull(),
|
|
8
8
|
emailVerified: integer("emailVerified", { mode: "timestamp_ms" }),
|
|
9
9
|
image: text("image"),
|
|
10
10
|
});
|
|
11
|
-
const accounts = sqliteTable("
|
|
11
|
+
const accounts = sqliteTable("account", {
|
|
12
12
|
userId: text("userId")
|
|
13
13
|
.notNull()
|
|
14
14
|
.references(() => users.id, { onDelete: "cascade" }),
|
|
@@ -25,7 +25,7 @@ export function createTables(sqliteTable) {
|
|
|
25
25
|
}, (account) => ({
|
|
26
26
|
compoundKey: primaryKey(account.provider, account.providerAccountId),
|
|
27
27
|
}));
|
|
28
|
-
const sessions = sqliteTable("
|
|
28
|
+
const sessions = sqliteTable("session", {
|
|
29
29
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
30
30
|
userId: text("userId")
|
|
31
31
|
.notNull()
|
|
@@ -116,7 +116,7 @@ export function SQLiteDrizzleAdapter(client, tableFn = defaultSqliteTableFn) {
|
|
|
116
116
|
.leftJoin(users, eq(users.id, accounts.userId))
|
|
117
117
|
.where(and(eq(accounts.provider, account.provider), eq(accounts.providerAccountId, account.providerAccountId)))
|
|
118
118
|
.get();
|
|
119
|
-
return results?.
|
|
119
|
+
return results?.user ?? null;
|
|
120
120
|
},
|
|
121
121
|
deleteSession(sessionToken) {
|
|
122
122
|
return (client
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@auth/drizzle-adapter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Drizzle adapter for Auth.js.",
|
|
5
5
|
"homepage": "https://authjs.dev",
|
|
6
6
|
"repository": "https://github.com/nextauthjs/next-auth",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"types": "./index.d.ts",
|
|
13
13
|
"files": [
|
|
14
|
-
"*.js",
|
|
15
14
|
"*.d.ts*",
|
|
15
|
+
"*.js",
|
|
16
16
|
"lib",
|
|
17
17
|
"src"
|
|
18
18
|
],
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@auth/core": "0.
|
|
39
|
+
"@auth/core": "0.11.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/better-sqlite3": "^7.6.4",
|
package/src/index.ts
CHANGED
|
@@ -77,7 +77,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
77
77
|
* } from "drizzle-orm/pg-core"
|
|
78
78
|
* import type { AdapterAccount } from '@auth/core/adapters'
|
|
79
79
|
*
|
|
80
|
-
* export const users = pgTable("
|
|
80
|
+
* export const users = pgTable("user", {
|
|
81
81
|
* id: text("id").notNull().primaryKey(),
|
|
82
82
|
* name: text("name"),
|
|
83
83
|
* email: text("email").notNull(),
|
|
@@ -86,7 +86,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
86
86
|
* })
|
|
87
87
|
*
|
|
88
88
|
* export const accounts = pgTable(
|
|
89
|
-
* "
|
|
89
|
+
* "account",
|
|
90
90
|
* {
|
|
91
91
|
* userId: text("userId")
|
|
92
92
|
* .notNull()
|
|
@@ -107,7 +107,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
107
107
|
* })
|
|
108
108
|
* )
|
|
109
109
|
*
|
|
110
|
-
* export const sessions = pgTable("
|
|
110
|
+
* export const sessions = pgTable("session", {
|
|
111
111
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
112
112
|
* userId: text("userId")
|
|
113
113
|
* .notNull()
|
|
@@ -140,7 +140,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
140
140
|
* } from "drizzle-orm/mysql-core"
|
|
141
141
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
142
142
|
*
|
|
143
|
-
* export const users = mysqlTable("
|
|
143
|
+
* export const users = mysqlTable("user", {
|
|
144
144
|
* id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
145
145
|
* name: varchar("name", { length: 255 }),
|
|
146
146
|
* email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -149,7 +149,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
149
149
|
* })
|
|
150
150
|
*
|
|
151
151
|
* export const accounts = mysqlTable(
|
|
152
|
-
* "
|
|
152
|
+
* "account",
|
|
153
153
|
* {
|
|
154
154
|
* userId: varchar("userId", { length: 255 })
|
|
155
155
|
* .notNull()
|
|
@@ -170,7 +170,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
170
170
|
* })
|
|
171
171
|
* )
|
|
172
172
|
*
|
|
173
|
-
* export const sessions = mysqlTable("
|
|
173
|
+
* export const sessions = mysqlTable("session", {
|
|
174
174
|
* sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
|
|
175
175
|
* userId: varchar("userId", { length: 255 })
|
|
176
176
|
* .notNull()
|
|
@@ -197,7 +197,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
197
197
|
* import { integer, sqliteTable, text, primaryKey } from "drizzle-orm/sqlite-core"
|
|
198
198
|
* import type { AdapterAccount } from "@auth/core/adapters"
|
|
199
199
|
*
|
|
200
|
-
* export const users = sqliteTable("
|
|
200
|
+
* export const users = sqliteTable("user", {
|
|
201
201
|
* id: text("id").notNull().primaryKey(),
|
|
202
202
|
* name: text("name"),
|
|
203
203
|
* email: text("email").notNull(),
|
|
@@ -206,7 +206,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
206
206
|
* })
|
|
207
207
|
*
|
|
208
208
|
* export const accounts = sqliteTable(
|
|
209
|
-
* "
|
|
209
|
+
* "account",
|
|
210
210
|
* {
|
|
211
211
|
* userId: text("userId")
|
|
212
212
|
* .notNull()
|
|
@@ -227,7 +227,7 @@ import type { Adapter } from "@auth/core/adapters"
|
|
|
227
227
|
* })
|
|
228
228
|
* )
|
|
229
229
|
*
|
|
230
|
-
* export const sessions = sqliteTable("
|
|
230
|
+
* export const sessions = sqliteTable("session", {
|
|
231
231
|
* sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
232
232
|
* userId: text("userId")
|
|
233
233
|
* .notNull()
|
package/src/lib/mysql.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { Adapter, AdapterAccount } from "@auth/core/adapters"
|
|
|
12
12
|
import type { MySql2Database } from "drizzle-orm/mysql2"
|
|
13
13
|
|
|
14
14
|
export function createTables(mySqlTable: MySqlTableFn) {
|
|
15
|
-
const users = mySqlTable("
|
|
15
|
+
const users = mySqlTable("user", {
|
|
16
16
|
id: varchar("id", { length: 255 }).notNull().primaryKey(),
|
|
17
17
|
name: varchar("name", { length: 255 }),
|
|
18
18
|
email: varchar("email", { length: 255 }).notNull(),
|
|
@@ -24,7 +24,7 @@ export function createTables(mySqlTable: MySqlTableFn) {
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
const accounts = mySqlTable(
|
|
27
|
-
"
|
|
27
|
+
"account",
|
|
28
28
|
{
|
|
29
29
|
userId: varchar("userId", { length: 255 })
|
|
30
30
|
.notNull()
|
|
@@ -49,7 +49,7 @@ export function createTables(mySqlTable: MySqlTableFn) {
|
|
|
49
49
|
})
|
|
50
50
|
)
|
|
51
51
|
|
|
52
|
-
const sessions = mySqlTable("
|
|
52
|
+
const sessions = mySqlTable("session", {
|
|
53
53
|
sessionToken: varchar("sessionToken", { length: 255 })
|
|
54
54
|
.notNull()
|
|
55
55
|
.primaryKey(),
|
|
@@ -187,7 +187,7 @@ export function mySqlDrizzleAdapter(
|
|
|
187
187
|
return null
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
return dbAccount.
|
|
190
|
+
return dbAccount.user
|
|
191
191
|
},
|
|
192
192
|
async deleteSession(sessionToken) {
|
|
193
193
|
const session =
|
package/src/lib/pg.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { PostgresJsDatabase } from "drizzle-orm/postgres-js"
|
|
|
12
12
|
import type { Adapter, AdapterAccount } from "@auth/core/adapters"
|
|
13
13
|
|
|
14
14
|
export function createTables(pgTable: PgTableFn) {
|
|
15
|
-
const users = pgTable("
|
|
15
|
+
const users = pgTable("user", {
|
|
16
16
|
id: text("id").notNull().primaryKey(),
|
|
17
17
|
name: text("name"),
|
|
18
18
|
email: text("email").notNull(),
|
|
@@ -21,7 +21,7 @@ export function createTables(pgTable: PgTableFn) {
|
|
|
21
21
|
})
|
|
22
22
|
|
|
23
23
|
const accounts = pgTable(
|
|
24
|
-
"
|
|
24
|
+
"account",
|
|
25
25
|
{
|
|
26
26
|
userId: text("userId")
|
|
27
27
|
.notNull()
|
|
@@ -42,7 +42,7 @@ export function createTables(pgTable: PgTableFn) {
|
|
|
42
42
|
})
|
|
43
43
|
)
|
|
44
44
|
|
|
45
|
-
const sessions = pgTable("
|
|
45
|
+
const sessions = pgTable("session", {
|
|
46
46
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
47
47
|
userId: text("userId")
|
|
48
48
|
.notNull()
|
|
@@ -174,7 +174,7 @@ export function pgDrizzleAdapter(
|
|
|
174
174
|
return null
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
return dbAccount.
|
|
177
|
+
return dbAccount.user
|
|
178
178
|
},
|
|
179
179
|
async deleteSession(sessionToken) {
|
|
180
180
|
const session = await client
|
package/src/lib/sqlite.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import type { Adapter, AdapterAccount } from "@auth/core/adapters"
|
|
12
12
|
|
|
13
13
|
export function createTables(sqliteTable: SQLiteTableFn) {
|
|
14
|
-
const users = sqliteTable("
|
|
14
|
+
const users = sqliteTable("user", {
|
|
15
15
|
id: text("id").notNull().primaryKey(),
|
|
16
16
|
name: text("name"),
|
|
17
17
|
email: text("email").notNull(),
|
|
@@ -20,7 +20,7 @@ export function createTables(sqliteTable: SQLiteTableFn) {
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
const accounts = sqliteTable(
|
|
23
|
-
"
|
|
23
|
+
"account",
|
|
24
24
|
{
|
|
25
25
|
userId: text("userId")
|
|
26
26
|
.notNull()
|
|
@@ -41,7 +41,7 @@ export function createTables(sqliteTable: SQLiteTableFn) {
|
|
|
41
41
|
})
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
const sessions = sqliteTable("
|
|
44
|
+
const sessions = sqliteTable("session", {
|
|
45
45
|
sessionToken: text("sessionToken").notNull().primaryKey(),
|
|
46
46
|
userId: text("userId")
|
|
47
47
|
.notNull()
|
|
@@ -159,7 +159,7 @@ export function SQLiteDrizzleAdapter(
|
|
|
159
159
|
)
|
|
160
160
|
.get()
|
|
161
161
|
|
|
162
|
-
return results?.
|
|
162
|
+
return results?.user ?? null
|
|
163
163
|
},
|
|
164
164
|
deleteSession(sessionToken) {
|
|
165
165
|
return (
|