@auth/drizzle-adapter 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  <img height="64px" src="https://authjs.dev/img/logo/logo-sm.png" />
5
5
  </a>
6
6
  <a href="https://github.com/drizzle-team/drizzle-orm" target="_blank">
7
- <img height="64px" src="https://pbs.twimg.com/profile_images/1598308842391179266/CtXrfLnk_400x400.jpg"/>
7
+ <img height="64px" src="https://authjs.dev/img/adapters/drizzle-orm.png"/>
8
8
  </a>
9
9
  <h3 align="center"><b>Drizzle ORM Adapter</b> - NextAuth.js / Auth.js</a></h3>
10
10
  <p align="center" style="align: center;">
package/index.d.ts CHANGED
@@ -15,10 +15,10 @@
15
15
  *
16
16
  * @module @auth/drizzle-adapter
17
17
  */
18
- import { SqlFlavorOptions } from "./lib/utils.js";
18
+ import { SqlFlavorOptions, TableFn } from "./lib/utils.js";
19
19
  import type { Adapter } from "@auth/core/adapters";
20
20
  /**
21
- * Add the adapter to your `app/api/[...nextauth]/route.js` next-auth configuration object.
21
+ * Add the adapter to your `pages/api/[...nextauth].ts` next-auth configuration object.
22
22
  *
23
23
  * ```ts title="pages/api/auth/[...nextauth].ts"
24
24
  * import NextAuth from "next-auth"
@@ -37,6 +37,10 @@ import type { Adapter } from "@auth/core/adapters";
37
37
  * })
38
38
  * ```
39
39
  *
40
+ * :::info
41
+ * If you're using multi-project schemas, you can pass your table function as a second argument
42
+ * :::
43
+ *
40
44
  * ## Setup
41
45
  *
42
46
  * First, create a schema that includes [the minimum requirements for a `next-auth` adapter](/reference/adapters#models). You can select your favorite SQL flavor below and copy it.
@@ -237,5 +241,5 @@ import type { Adapter } from "@auth/core/adapters";
237
241
  * ---
238
242
  *
239
243
  **/
240
- export declare function DrizzleAdapter<SqlFlavor extends SqlFlavorOptions>(db: SqlFlavor): Adapter;
244
+ export declare function DrizzleAdapter<SqlFlavor extends SqlFlavorOptions>(db: SqlFlavor, table?: TableFn<SqlFlavor>): Adapter;
241
245
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAIL,gBAAgB,EACjB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2NI;AACJ,wBAAgB,cAAc,CAAC,SAAS,SAAS,gBAAgB,EAC/D,EAAE,EAAE,SAAS,GACZ,OAAO,CAeT"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,EAIL,gBAAgB,EAChB,OAAO,EACR,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+NI;AACJ,wBAAgB,cAAc,CAAC,SAAS,SAAS,gBAAgB,EAC/D,EAAE,EAAE,SAAS,EACb,KAAK,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,GACzB,OAAO,CAeT"}
package/index.js CHANGED
@@ -20,7 +20,7 @@ import { pgDrizzleAdapter } from "./lib/pg.js";
20
20
  import { SQLiteDrizzleAdapter } from "./lib/sqlite.js";
21
21
  import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js";
22
22
  /**
23
- * Add the adapter to your `app/api/[...nextauth]/route.js` next-auth configuration object.
23
+ * Add the adapter to your `pages/api/[...nextauth].ts` next-auth configuration object.
24
24
  *
25
25
  * ```ts title="pages/api/auth/[...nextauth].ts"
26
26
  * import NextAuth from "next-auth"
@@ -39,6 +39,10 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
39
39
  * })
40
40
  * ```
41
41
  *
42
+ * :::info
43
+ * If you're using multi-project schemas, you can pass your table function as a second argument
44
+ * :::
45
+ *
42
46
  * ## Setup
43
47
  *
44
48
  * First, create a schema that includes [the minimum requirements for a `next-auth` adapter](/reference/adapters#models). You can select your favorite SQL flavor below and copy it.
@@ -239,16 +243,16 @@ import { isMySqlDatabase, isPgDatabase, isSQLiteDatabase, } from "./lib/utils.js
239
243
  * ---
240
244
  *
241
245
  **/
242
- export function DrizzleAdapter(db) {
246
+ export function DrizzleAdapter(db, table) {
243
247
  if (isMySqlDatabase(db)) {
244
248
  // We need to cast to unknown since the type overlaps (PScale is MySQL based)
245
- return mySqlDrizzleAdapter(db);
249
+ return mySqlDrizzleAdapter(db, table);
246
250
  }
247
251
  if (isPgDatabase(db)) {
248
- return pgDrizzleAdapter(db);
252
+ return pgDrizzleAdapter(db, table);
249
253
  }
250
254
  if (isSQLiteDatabase(db)) {
251
- return SQLiteDrizzleAdapter(db);
255
+ return SQLiteDrizzleAdapter(db, table);
252
256
  }
253
257
  throw new Error("Unsupported database type in Auth.js Drizzle adapter.");
254
258
  }
package/lib/mysql.d.ts CHANGED
@@ -1,224 +1,7 @@
1
+ import { MySqlTableFn } from "drizzle-orm/mysql-core";
1
2
  import type { Adapter } from "@auth/core/adapters";
2
3
  import type { MySql2Database } from "drizzle-orm/mysql2";
3
- export declare const users: import("drizzle-orm/select.types.d-b947a018").aw<{
4
- name: "users";
5
- schema: undefined;
6
- columns: {
7
- id: import("drizzle-orm/mysql-core").MySqlVarChar<{
8
- tableName: "users";
9
- enumValues: [string, ...string[]];
10
- name: "id";
11
- data: string;
12
- driverParam: string | number;
13
- hasDefault: false;
14
- notNull: true;
15
- }>;
16
- name: import("drizzle-orm/mysql-core").MySqlVarChar<{
17
- tableName: "users";
18
- name: "name";
19
- data: string;
20
- driverParam: string | number;
21
- enumValues: [string, ...string[]];
22
- notNull: false;
23
- hasDefault: false;
24
- }>;
25
- email: import("drizzle-orm/mysql-core").MySqlVarChar<{
26
- tableName: "users";
27
- enumValues: [string, ...string[]];
28
- name: "email";
29
- data: string;
30
- driverParam: string | number;
31
- hasDefault: false;
32
- notNull: true;
33
- }>;
34
- emailVerified: import("drizzle-orm/mysql-core").MySqlTimestamp<{
35
- tableName: "users";
36
- name: "emailVerified";
37
- data: Date;
38
- driverParam: string | number;
39
- notNull: false;
40
- hasDefault: true;
41
- }>;
42
- image: import("drizzle-orm/mysql-core").MySqlVarChar<{
43
- tableName: "users";
44
- name: "image";
45
- data: string;
46
- driverParam: string | number;
47
- enumValues: [string, ...string[]];
48
- notNull: false;
49
- hasDefault: false;
50
- }>;
51
- };
52
- }>;
53
- export declare const accounts: import("drizzle-orm/select.types.d-b947a018").aw<{
54
- name: "accounts";
55
- schema: undefined;
56
- columns: {
57
- userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
58
- tableName: "accounts";
59
- enumValues: [string, ...string[]];
60
- name: "userId";
61
- data: string;
62
- driverParam: string | number;
63
- hasDefault: false;
64
- notNull: true;
65
- }>;
66
- type: import("drizzle-orm/mysql-core").MySqlVarChar<{
67
- tableName: "accounts";
68
- enumValues: [string, ...string[]];
69
- name: "type";
70
- data: "email" | "oidc" | "oauth";
71
- driverParam: string | number;
72
- hasDefault: false;
73
- notNull: true;
74
- }>;
75
- provider: import("drizzle-orm/mysql-core").MySqlVarChar<{
76
- tableName: "accounts";
77
- enumValues: [string, ...string[]];
78
- name: "provider";
79
- data: string;
80
- driverParam: string | number;
81
- hasDefault: false;
82
- notNull: true;
83
- }>;
84
- providerAccountId: import("drizzle-orm/mysql-core").MySqlVarChar<{
85
- tableName: "accounts";
86
- enumValues: [string, ...string[]];
87
- name: "providerAccountId";
88
- data: string;
89
- driverParam: string | number;
90
- hasDefault: false;
91
- notNull: true;
92
- }>;
93
- refresh_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
94
- tableName: "accounts";
95
- name: "refresh_token";
96
- data: string;
97
- driverParam: string | number;
98
- enumValues: [string, ...string[]];
99
- notNull: false;
100
- hasDefault: false;
101
- }>;
102
- access_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
103
- tableName: "accounts";
104
- name: "access_token";
105
- data: string;
106
- driverParam: string | number;
107
- enumValues: [string, ...string[]];
108
- notNull: false;
109
- hasDefault: false;
110
- }>;
111
- expires_at: import("drizzle-orm/mysql-core").MySqlInt<{
112
- tableName: "accounts";
113
- name: "expires_at";
114
- data: number;
115
- driverParam: string | number;
116
- notNull: false;
117
- hasDefault: false;
118
- }>;
119
- token_type: import("drizzle-orm/mysql-core").MySqlVarChar<{
120
- tableName: "accounts";
121
- name: "token_type";
122
- data: string;
123
- driverParam: string | number;
124
- enumValues: [string, ...string[]];
125
- notNull: false;
126
- hasDefault: false;
127
- }>;
128
- scope: import("drizzle-orm/mysql-core").MySqlVarChar<{
129
- tableName: "accounts";
130
- name: "scope";
131
- data: string;
132
- driverParam: string | number;
133
- enumValues: [string, ...string[]];
134
- notNull: false;
135
- hasDefault: false;
136
- }>;
137
- id_token: import("drizzle-orm/mysql-core").MySqlVarChar<{
138
- tableName: "accounts";
139
- name: "id_token";
140
- data: string;
141
- driverParam: string | number;
142
- enumValues: [string, ...string[]];
143
- notNull: false;
144
- hasDefault: false;
145
- }>;
146
- session_state: import("drizzle-orm/mysql-core").MySqlVarChar<{
147
- tableName: "accounts";
148
- name: "session_state";
149
- data: string;
150
- driverParam: string | number;
151
- enumValues: [string, ...string[]];
152
- notNull: false;
153
- hasDefault: false;
154
- }>;
155
- };
156
- }>;
157
- export declare const sessions: import("drizzle-orm/select.types.d-b947a018").aw<{
158
- name: "sessions";
159
- schema: undefined;
160
- columns: {
161
- sessionToken: import("drizzle-orm/mysql-core").MySqlVarChar<{
162
- tableName: "sessions";
163
- enumValues: [string, ...string[]];
164
- name: "sessionToken";
165
- data: string;
166
- driverParam: string | number;
167
- hasDefault: false;
168
- notNull: true;
169
- }>;
170
- userId: import("drizzle-orm/mysql-core").MySqlVarChar<{
171
- tableName: "sessions";
172
- enumValues: [string, ...string[]];
173
- name: "userId";
174
- data: string;
175
- driverParam: string | number;
176
- hasDefault: false;
177
- notNull: true;
178
- }>;
179
- expires: import("drizzle-orm/mysql-core").MySqlTimestamp<{
180
- tableName: "sessions";
181
- name: "expires";
182
- data: Date;
183
- driverParam: string | number;
184
- hasDefault: false;
185
- notNull: true;
186
- }>;
187
- };
188
- }>;
189
- export declare const verificationTokens: import("drizzle-orm/select.types.d-b947a018").aw<{
190
- name: "verificationToken";
191
- schema: undefined;
192
- columns: {
193
- identifier: import("drizzle-orm/mysql-core").MySqlVarChar<{
194
- tableName: "verificationToken";
195
- enumValues: [string, ...string[]];
196
- name: "identifier";
197
- data: string;
198
- driverParam: string | number;
199
- hasDefault: false;
200
- notNull: true;
201
- }>;
202
- token: import("drizzle-orm/mysql-core").MySqlVarChar<{
203
- tableName: "verificationToken";
204
- enumValues: [string, ...string[]];
205
- name: "token";
206
- data: string;
207
- driverParam: string | number;
208
- hasDefault: false;
209
- notNull: true;
210
- }>;
211
- expires: import("drizzle-orm/mysql-core").MySqlTimestamp<{
212
- tableName: "verificationToken";
213
- name: "expires";
214
- data: Date;
215
- driverParam: string | number;
216
- hasDefault: false;
217
- notNull: true;
218
- }>;
219
- };
220
- }>;
221
- export declare const schema: {
4
+ export declare function createTables(mySqlTable: MySqlTableFn): {
222
5
  users: import("drizzle-orm/select.types.d-b947a018").aw<{
223
6
  name: "users";
224
7
  schema: undefined;
@@ -438,6 +221,6 @@ export declare const schema: {
438
221
  };
439
222
  }>;
440
223
  };
441
- export type DefaultSchema = typeof schema;
442
- export declare function mySqlDrizzleAdapter(client: MySql2Database<Record<string, never>>): Adapter;
224
+ export type DefaultSchema = ReturnType<typeof createTables>;
225
+ export declare function mySqlDrizzleAdapter(client: MySql2Database<Record<string, never>>, tableFn?: MySqlTableFn<undefined>): Adapter;
443
226
  //# sourceMappingURL=mysql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../src/lib/mysql.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAShB,CAAA;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBpB,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMnB,CAAA;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAA;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoD,CAAA;AACvE,MAAM,MAAM,aAAa,GAAG,OAAO,MAAM,CAAA;AAEzC,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,GAC5C,OAAO,CAsLT"}
1
+ {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../src/lib/mysql.ts"],"names":[],"mappings":"AACA,OAAO,EAML,YAAY,EACb,MAAM,wBAAwB,CAAA;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,wBAAgB,YAAY,CAAC,UAAU,EAAE,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DpD;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;AAE3D,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,EAC7C,OAAO,0BAAsB,GAC5B,OAAO,CAyLT"}
package/lib/mysql.js CHANGED
@@ -1,50 +1,57 @@
1
1
  import { and, eq } from "drizzle-orm";
2
- import { int, timestamp, mysqlTable, primaryKey, varchar, } from "drizzle-orm/mysql-core";
3
- export const users = mysqlTable("users", {
4
- id: varchar("id", { length: 255 }).notNull().primaryKey(),
5
- name: varchar("name", { length: 255 }),
6
- email: varchar("email", { length: 255 }).notNull(),
7
- emailVerified: timestamp("emailVerified", {
8
- mode: "date",
9
- fsp: 3,
10
- }).defaultNow(),
11
- image: varchar("image", { length: 255 }),
12
- });
13
- export const accounts = mysqlTable("accounts", {
14
- userId: varchar("userId", { length: 255 })
15
- .notNull()
16
- .references(() => users.id, { onDelete: "cascade" }),
17
- type: varchar("type", { length: 255 })
18
- .$type()
19
- .notNull(),
20
- provider: varchar("provider", { length: 255 }).notNull(),
21
- providerAccountId: varchar("providerAccountId", { length: 255 }).notNull(),
22
- refresh_token: varchar("refresh_token", { length: 255 }),
23
- access_token: varchar("access_token", { length: 255 }),
24
- expires_at: int("expires_at"),
25
- token_type: varchar("token_type", { length: 255 }),
26
- scope: varchar("scope", { length: 255 }),
27
- id_token: varchar("id_token", { length: 255 }),
28
- session_state: varchar("session_state", { length: 255 }),
29
- }, (account) => ({
30
- compoundKey: primaryKey(account.provider, account.providerAccountId),
31
- }));
32
- export const sessions = mysqlTable("sessions", {
33
- sessionToken: varchar("sessionToken", { length: 255 }).notNull().primaryKey(),
34
- userId: varchar("userId", { length: 255 })
35
- .notNull()
36
- .references(() => users.id, { onDelete: "cascade" }),
37
- expires: timestamp("expires", { mode: "date" }).notNull(),
38
- });
39
- export const verificationTokens = mysqlTable("verificationToken", {
40
- identifier: varchar("identifier", { length: 255 }).notNull(),
41
- token: varchar("token", { length: 255 }).notNull(),
42
- expires: timestamp("expires", { mode: "date" }).notNull(),
43
- }, (vt) => ({
44
- compoundKey: primaryKey(vt.identifier, vt.token),
45
- }));
46
- export const schema = { users, accounts, sessions, verificationTokens };
47
- export function mySqlDrizzleAdapter(client) {
2
+ import { int, timestamp, mysqlTable as defaultMySqlTableFn, primaryKey, varchar, } from "drizzle-orm/mysql-core";
3
+ export function createTables(mySqlTable) {
4
+ const users = mySqlTable("users", {
5
+ id: varchar("id", { length: 255 }).notNull().primaryKey(),
6
+ name: varchar("name", { length: 255 }),
7
+ email: varchar("email", { length: 255 }).notNull(),
8
+ emailVerified: timestamp("emailVerified", {
9
+ mode: "date",
10
+ fsp: 3,
11
+ }).defaultNow(),
12
+ image: varchar("image", { length: 255 }),
13
+ });
14
+ const accounts = mySqlTable("accounts", {
15
+ userId: varchar("userId", { length: 255 })
16
+ .notNull()
17
+ .references(() => users.id, { onDelete: "cascade" }),
18
+ type: varchar("type", { length: 255 })
19
+ .$type()
20
+ .notNull(),
21
+ provider: varchar("provider", { length: 255 }).notNull(),
22
+ providerAccountId: varchar("providerAccountId", {
23
+ length: 255,
24
+ }).notNull(),
25
+ refresh_token: varchar("refresh_token", { length: 255 }),
26
+ access_token: varchar("access_token", { length: 255 }),
27
+ expires_at: int("expires_at"),
28
+ token_type: varchar("token_type", { length: 255 }),
29
+ scope: varchar("scope", { length: 255 }),
30
+ id_token: varchar("id_token", { length: 255 }),
31
+ session_state: varchar("session_state", { length: 255 }),
32
+ }, (account) => ({
33
+ compoundKey: primaryKey(account.provider, account.providerAccountId),
34
+ }));
35
+ const sessions = mySqlTable("sessions", {
36
+ sessionToken: varchar("sessionToken", { length: 255 })
37
+ .notNull()
38
+ .primaryKey(),
39
+ userId: varchar("userId", { length: 255 })
40
+ .notNull()
41
+ .references(() => users.id, { onDelete: "cascade" }),
42
+ expires: timestamp("expires", { mode: "date" }).notNull(),
43
+ });
44
+ const verificationTokens = mySqlTable("verificationToken", {
45
+ identifier: varchar("identifier", { length: 255 }).notNull(),
46
+ token: varchar("token", { length: 255 }).notNull(),
47
+ expires: timestamp("expires", { mode: "date" }).notNull(),
48
+ }, (vt) => ({
49
+ compoundKey: primaryKey(vt.identifier, vt.token),
50
+ }));
51
+ return { users, accounts, sessions, verificationTokens };
52
+ }
53
+ export function mySqlDrizzleAdapter(client, tableFn = defaultMySqlTableFn) {
54
+ const { users, accounts, sessions, verificationTokens } = createTables(tableFn);
48
55
  return {
49
56
  async createUser(data) {
50
57
  const id = crypto.randomUUID();
package/lib/pg.d.ts CHANGED
@@ -1,224 +1,7 @@
1
+ import { PgTableFn } from "drizzle-orm/pg-core";
1
2
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
3
  import type { Adapter } from "@auth/core/adapters";
3
- export declare const users: import("drizzle-orm/db.d-b9835153").az<{
4
- name: "users";
5
- schema: undefined;
6
- columns: {
7
- id: import("drizzle-orm/pg-core").PgText<{
8
- tableName: "users";
9
- enumValues: [string, ...string[]];
10
- name: "id";
11
- data: string;
12
- driverParam: string;
13
- hasDefault: false;
14
- notNull: true;
15
- }>;
16
- name: import("drizzle-orm/pg-core").PgText<{
17
- tableName: "users";
18
- name: "name";
19
- data: string;
20
- enumValues: [string, ...string[]];
21
- driverParam: string;
22
- notNull: false;
23
- hasDefault: false;
24
- }>;
25
- email: import("drizzle-orm/pg-core").PgText<{
26
- tableName: "users";
27
- enumValues: [string, ...string[]];
28
- name: "email";
29
- data: string;
30
- driverParam: string;
31
- hasDefault: false;
32
- notNull: true;
33
- }>;
34
- emailVerified: import("drizzle-orm/pg-core").PgTimestamp<{
35
- tableName: "users";
36
- name: "emailVerified";
37
- data: Date;
38
- driverParam: string;
39
- notNull: false;
40
- hasDefault: false;
41
- }>;
42
- image: import("drizzle-orm/pg-core").PgText<{
43
- tableName: "users";
44
- name: "image";
45
- data: string;
46
- enumValues: [string, ...string[]];
47
- driverParam: string;
48
- notNull: false;
49
- hasDefault: false;
50
- }>;
51
- };
52
- }>;
53
- export declare const accounts: import("drizzle-orm/db.d-b9835153").az<{
54
- name: "accounts";
55
- schema: undefined;
56
- columns: {
57
- userId: import("drizzle-orm/pg-core").PgText<{
58
- tableName: "accounts";
59
- enumValues: [string, ...string[]];
60
- name: "userId";
61
- data: string;
62
- driverParam: string;
63
- hasDefault: false;
64
- notNull: true;
65
- }>;
66
- type: import("drizzle-orm/pg-core").PgText<{
67
- tableName: "accounts";
68
- enumValues: [string, ...string[]];
69
- name: "type";
70
- data: "email" | "oidc" | "oauth";
71
- driverParam: string;
72
- hasDefault: false;
73
- notNull: true;
74
- }>;
75
- provider: import("drizzle-orm/pg-core").PgText<{
76
- tableName: "accounts";
77
- enumValues: [string, ...string[]];
78
- name: "provider";
79
- data: string;
80
- driverParam: string;
81
- hasDefault: false;
82
- notNull: true;
83
- }>;
84
- providerAccountId: import("drizzle-orm/pg-core").PgText<{
85
- tableName: "accounts";
86
- enumValues: [string, ...string[]];
87
- name: "providerAccountId";
88
- data: string;
89
- driverParam: string;
90
- hasDefault: false;
91
- notNull: true;
92
- }>;
93
- refresh_token: import("drizzle-orm/pg-core").PgText<{
94
- tableName: "accounts";
95
- name: "refresh_token";
96
- data: string;
97
- enumValues: [string, ...string[]];
98
- driverParam: string;
99
- notNull: false;
100
- hasDefault: false;
101
- }>;
102
- access_token: import("drizzle-orm/pg-core").PgText<{
103
- tableName: "accounts";
104
- name: "access_token";
105
- data: string;
106
- enumValues: [string, ...string[]];
107
- driverParam: string;
108
- notNull: false;
109
- hasDefault: false;
110
- }>;
111
- expires_at: import("drizzle-orm/pg-core").PgInteger<{
112
- tableName: "accounts";
113
- name: "expires_at";
114
- data: number;
115
- driverParam: string | number;
116
- hasDefault: false;
117
- notNull: false;
118
- }>;
119
- token_type: import("drizzle-orm/pg-core").PgText<{
120
- tableName: "accounts";
121
- name: "token_type";
122
- data: string;
123
- enumValues: [string, ...string[]];
124
- driverParam: string;
125
- notNull: false;
126
- hasDefault: false;
127
- }>;
128
- scope: import("drizzle-orm/pg-core").PgText<{
129
- tableName: "accounts";
130
- name: "scope";
131
- data: string;
132
- enumValues: [string, ...string[]];
133
- driverParam: string;
134
- notNull: false;
135
- hasDefault: false;
136
- }>;
137
- id_token: import("drizzle-orm/pg-core").PgText<{
138
- tableName: "accounts";
139
- name: "id_token";
140
- data: string;
141
- enumValues: [string, ...string[]];
142
- driverParam: string;
143
- notNull: false;
144
- hasDefault: false;
145
- }>;
146
- session_state: import("drizzle-orm/pg-core").PgText<{
147
- tableName: "accounts";
148
- name: "session_state";
149
- data: string;
150
- enumValues: [string, ...string[]];
151
- driverParam: string;
152
- notNull: false;
153
- hasDefault: false;
154
- }>;
155
- };
156
- }>;
157
- export declare const sessions: import("drizzle-orm/db.d-b9835153").az<{
158
- name: "sessions";
159
- schema: undefined;
160
- columns: {
161
- sessionToken: import("drizzle-orm/pg-core").PgText<{
162
- tableName: "sessions";
163
- enumValues: [string, ...string[]];
164
- name: "sessionToken";
165
- data: string;
166
- driverParam: string;
167
- hasDefault: false;
168
- notNull: true;
169
- }>;
170
- userId: import("drizzle-orm/pg-core").PgText<{
171
- tableName: "sessions";
172
- enumValues: [string, ...string[]];
173
- name: "userId";
174
- data: string;
175
- driverParam: string;
176
- hasDefault: false;
177
- notNull: true;
178
- }>;
179
- expires: import("drizzle-orm/pg-core").PgTimestamp<{
180
- tableName: "sessions";
181
- name: "expires";
182
- data: Date;
183
- driverParam: string;
184
- hasDefault: false;
185
- notNull: true;
186
- }>;
187
- };
188
- }>;
189
- export declare const verificationTokens: import("drizzle-orm/db.d-b9835153").az<{
190
- name: "verificationToken";
191
- schema: undefined;
192
- columns: {
193
- identifier: import("drizzle-orm/pg-core").PgText<{
194
- tableName: "verificationToken";
195
- enumValues: [string, ...string[]];
196
- name: "identifier";
197
- data: string;
198
- driverParam: string;
199
- hasDefault: false;
200
- notNull: true;
201
- }>;
202
- token: import("drizzle-orm/pg-core").PgText<{
203
- tableName: "verificationToken";
204
- enumValues: [string, ...string[]];
205
- name: "token";
206
- data: string;
207
- driverParam: string;
208
- hasDefault: false;
209
- notNull: true;
210
- }>;
211
- expires: import("drizzle-orm/pg-core").PgTimestamp<{
212
- tableName: "verificationToken";
213
- name: "expires";
214
- data: Date;
215
- driverParam: string;
216
- hasDefault: false;
217
- notNull: true;
218
- }>;
219
- };
220
- }>;
221
- export declare const schema: {
4
+ export declare function createTables(pgTable: PgTableFn): {
222
5
  users: import("drizzle-orm/db.d-b9835153").az<{
223
6
  name: "users";
224
7
  schema: undefined;
@@ -438,6 +221,6 @@ export declare const schema: {
438
221
  };
439
222
  }>;
440
223
  };
441
- export type DefaultSchema = typeof schema;
442
- export declare function pgDrizzleAdapter(client: PostgresJsDatabase<Record<string, never>>): Adapter;
224
+ export type DefaultSchema = ReturnType<typeof createTables>;
225
+ export declare function pgDrizzleAdapter(client: PostgresJsDatabase<Record<string, never>>, tableFn?: PgTableFn<undefined>): Adapter;
443
226
  //# sourceMappingURL=pg.d.ts.map