-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathauth-schema.ts
86 lines (82 loc) · 2.13 KB
/
auth-schema.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
export const user = sqliteTable('user', {
id: text('id').primaryKey(),
name: text('name').notNull(),
email: text('email').notNull().unique(),
emailVerified: integer('emailVerified', {
mode: 'boolean'
}).notNull(),
image: text('image'),
createdAt: integer('createdAt', {
mode: 'timestamp'
}).notNull(),
updatedAt: integer('updatedAt', {
mode: 'timestamp'
}).notNull(),
role: text('role'),
banned: integer('banned', {
mode: 'boolean'
}),
banReason: text('banReason'),
banExpires: integer('banExpires', {
mode: 'timestamp'
})
});
export const session = sqliteTable('session', {
id: text('id').primaryKey(),
expiresAt: integer('expiresAt', {
mode: 'timestamp'
}).notNull(),
token: text('token').notNull().unique(),
createdAt: integer('createdAt', {
mode: 'timestamp'
}).notNull(),
updatedAt: integer('updatedAt', {
mode: 'timestamp'
}).notNull(),
ipAddress: text('ipAddress'),
userAgent: text('userAgent'),
userId: text('userId')
.notNull()
.references(() => user.id),
impersonatedBy: text('impersonatedBy')
});
export const account = sqliteTable('account', {
id: text('id').primaryKey(),
accountId: text('accountId').notNull(),
providerId: text('providerId').notNull(),
userId: text('userId')
.notNull()
.references(() => user.id),
accessToken: text('accessToken'),
refreshToken: text('refreshToken'),
idToken: text('idToken'),
accessTokenExpiresAt: integer('accessTokenExpiresAt', {
mode: 'timestamp'
}),
refreshTokenExpiresAt: integer('refreshTokenExpiresAt', {
mode: 'timestamp'
}),
scope: text('scope'),
password: text('password'),
createdAt: integer('createdAt', {
mode: 'timestamp'
}).notNull(),
updatedAt: integer('updatedAt', {
mode: 'timestamp'
}).notNull()
});
export const verification = sqliteTable('verification', {
id: text('id').primaryKey(),
identifier: text('identifier').notNull(),
value: text('value').notNull(),
expiresAt: integer('expiresAt', {
mode: 'timestamp'
}).notNull(),
createdAt: integer('createdAt', {
mode: 'timestamp'
}),
updatedAt: integer('updatedAt', {
mode: 'timestamp'
})
});