@@ -7,16 +7,16 @@ import { ObjectSchema, Field } from '@objectstack/spec/data';
77 *
88 * Uses better-auth's native schema for seamless migration:
99 * - id: string
10- * - createdAt : Date
11- * - updatedAt : Date
12- * - providerId : string (e.g., 'google', 'github')
13- * - accountId : string (provider's user ID)
14- * - userId : string (link to user table)
15- * - accessToken : string | null
16- * - refreshToken : string | null
17- * - idToken : string | null
18- * - accessTokenExpiresAt : Date | null
19- * - refreshTokenExpiresAt : Date | null
10+ * - created_at : Date
11+ * - updated_at : Date
12+ * - provider_id : string (e.g., 'google', 'github')
13+ * - account_id : string (provider's user ID)
14+ * - user_id : string (link to user table)
15+ * - access_token : string | null
16+ * - refresh_token : string | null
17+ * - id_token : string | null
18+ * - access_token_expires_at : Date | null
19+ * - refresh_token_expires_at : Date | null
2020 * - scope: string | null
2121 * - password: string | null (for email/password provider)
2222 */
@@ -26,8 +26,8 @@ export const AuthAccount = ObjectSchema.create({
2626 pluralLabel : 'Accounts' ,
2727 icon : 'link' ,
2828 description : 'OAuth and authentication provider accounts' ,
29- titleFormat : '{providerId } - {accountId }' ,
30- compactLayout : [ 'providerId ' , 'userId ' , 'accountId ' ] ,
29+ titleFormat : '{provider_id } - {account_id }' ,
30+ compactLayout : [ 'provider_id ' , 'user_id ' , 'account_id ' ] ,
3131
3232 fields : {
3333 id : Field . text ( {
@@ -36,57 +36,57 @@ export const AuthAccount = ObjectSchema.create({
3636 readonly : true ,
3737 } ) ,
3838
39- createdAt : Field . datetime ( {
39+ created_at : Field . datetime ( {
4040 label : 'Created At' ,
4141 defaultValue : 'NOW()' ,
4242 readonly : true ,
4343 } ) ,
4444
45- updatedAt : Field . datetime ( {
45+ updated_at : Field . datetime ( {
4646 label : 'Updated At' ,
4747 defaultValue : 'NOW()' ,
4848 readonly : true ,
4949 } ) ,
5050
51- providerId : Field . text ( {
51+ provider_id : Field . text ( {
5252 label : 'Provider ID' ,
5353 required : true ,
5454 description : 'OAuth provider identifier (google, github, etc.)' ,
5555 } ) ,
5656
57- accountId : Field . text ( {
57+ account_id : Field . text ( {
5858 label : 'Provider Account ID' ,
5959 required : true ,
6060 description : "User's ID in the provider's system" ,
6161 } ) ,
6262
63- userId : Field . text ( {
63+ user_id : Field . text ( {
6464 label : 'User ID' ,
6565 required : true ,
6666 description : 'Link to user table' ,
6767 } ) ,
6868
69- accessToken : Field . textarea ( {
69+ access_token : Field . textarea ( {
7070 label : 'Access Token' ,
7171 required : false ,
7272 } ) ,
7373
74- refreshToken : Field . textarea ( {
74+ refresh_token : Field . textarea ( {
7575 label : 'Refresh Token' ,
7676 required : false ,
7777 } ) ,
7878
79- idToken : Field . textarea ( {
79+ id_token : Field . textarea ( {
8080 label : 'ID Token' ,
8181 required : false ,
8282 } ) ,
8383
84- accessTokenExpiresAt : Field . datetime ( {
84+ access_token_expires_at : Field . datetime ( {
8585 label : 'Access Token Expires At' ,
8686 required : false ,
8787 } ) ,
8888
89- refreshTokenExpiresAt : Field . datetime ( {
89+ refresh_token_expires_at : Field . datetime ( {
9090 label : 'Refresh Token Expires At' ,
9191 required : false ,
9292 } ) ,
@@ -105,8 +105,8 @@ export const AuthAccount = ObjectSchema.create({
105105
106106 // Database indexes for performance
107107 indexes : [
108- { fields : [ 'userId ' ] , unique : false } ,
109- { fields : [ 'providerId ' , 'accountId ' ] , unique : true } ,
108+ { fields : [ 'user_id ' ] , unique : false } ,
109+ { fields : [ 'provider_id ' , 'account_id ' ] , unique : true } ,
110110 ] ,
111111
112112 // Enable features
0 commit comments