@@ -14,10 +14,14 @@ const schema = defineSchema({
14
14
createdAt : v . number ( ) ,
15
15
updatedAt : v . number ( ) ,
16
16
twoFactorEnabled : v . optional ( v . boolean ( ) ) ,
17
+ isAnonymous : v . optional ( v . boolean ( ) ) ,
18
+ username : v . optional ( v . string ( ) ) ,
19
+ displayUsername : v . optional ( v . string ( ) ) ,
17
20
userId : v . optional ( v . string ( ) ) ,
18
21
} )
19
22
. index ( "email" , [ "email" ] )
20
- . index ( "userId" , [ "userId" ] ) ,
23
+ . index ( "userId" , [ "userId" ] )
24
+ . index ( "username" , [ "username" ] ) ,
21
25
22
26
session : defineTable ( {
23
27
expiresAt : v . number ( ) ,
@@ -31,7 +35,7 @@ const schema = defineSchema({
31
35
. index ( "token" , [ "token" ] )
32
36
. index ( "userId" , [ "userId" ] )
33
37
. index ( "expiresAt" , [ "expiresAt" ] )
34
- . index ( "expiresAt_userId" , [ "expiresAt" , "userId" ] ) ,
38
+ . index ( "expiresAt_userId" , [ "expiresAt" , "userId" ] ) ,
35
39
36
40
account : defineTable ( {
37
41
accountId : v . string ( ) ,
@@ -49,8 +53,8 @@ const schema = defineSchema({
49
53
} )
50
54
. index ( "userId" , [ "userId" ] )
51
55
. index ( "accountId" , [ "accountId" ] )
52
- . index ( "accountId_providerId" , [ "accountId" , "providerId" ] )
53
- . index ( "providerId_userId" , [ "providerId" , "userId" ] ) ,
56
+ . index ( "accountId_providerId" , [ "accountId" , "providerId" ] )
57
+ . index ( "providerId_userId" , [ "providerId" , "userId" ] ) ,
54
58
55
59
verification : defineTable ( {
56
60
identifier : v . string ( ) ,
@@ -66,8 +70,7 @@ const schema = defineSchema({
66
70
secret : v . string ( ) ,
67
71
backupCodes : v . string ( ) ,
68
72
userId : v . string ( ) ,
69
- } )
70
- . index ( "userId" , [ "userId" ] ) ,
73
+ } ) . index ( "userId" , [ "userId" ] ) ,
71
74
72
75
jwks : defineTable ( {
73
76
publicKey : v . string ( ) ,
@@ -79,50 +82,52 @@ const schema = defineSchema({
79
82
key : v . optional ( v . string ( ) ) ,
80
83
count : v . optional ( v . number ( ) ) ,
81
84
lastRequest : v . optional ( v . number ( ) ) ,
82
- } )
83
- . index ( "key" , [ "key" ] ) ,
84
-
85
+ } ) . index ( "key" , [ "key" ] ) ,
85
86
} ) ;
86
87
87
88
export default schema ;
88
89
89
90
export const specialFields = {
90
91
user : {
91
92
name : {
92
- sortable : true
93
+ sortable : true ,
93
94
} ,
94
95
email : {
95
96
sortable : true ,
96
- unique : true
97
- }
97
+ unique : true ,
98
+ } ,
99
+ username : {
100
+ sortable : true ,
101
+ unique : true ,
102
+ } ,
98
103
} ,
99
104
session : {
100
105
token : {
101
- unique : true
106
+ unique : true ,
102
107
} ,
103
108
userId : {
104
109
references : {
105
110
model : "user" ,
106
111
field : "id" ,
107
- onDelete : "cascade"
108
- }
109
- }
112
+ onDelete : "cascade" ,
113
+ } ,
114
+ } ,
110
115
} ,
111
116
account : {
112
117
userId : {
113
118
references : {
114
119
model : "user" ,
115
120
field : "id" ,
116
- onDelete : "cascade"
117
- }
118
- }
121
+ onDelete : "cascade" ,
122
+ } ,
123
+ } ,
119
124
} ,
120
125
twoFactor : {
121
126
userId : {
122
127
references : {
123
128
model : "user" ,
124
- field : "id"
125
- }
126
- }
127
- }
129
+ field : "id" ,
130
+ } ,
131
+ } ,
132
+ } ,
128
133
} ;
0 commit comments