@@ -4,36 +4,36 @@ import { type AccessToken, type AccountID, type OrgID, type RefreshToken } from
44import { Timestamps } from "../storage/schema.sql"
55
66export const AccountTable = sqliteTable ( "account" , {
7- id : text ( ) . $type < AccountID > ( ) . primaryKey ( ) ,
8- email : text ( ) . notNull ( ) ,
9- url : text ( ) . notNull ( ) ,
10- access_token : text ( ) . $type < AccessToken > ( ) . notNull ( ) ,
11- refresh_token : text ( ) . $type < RefreshToken > ( ) . notNull ( ) ,
12- token_expiry : integer ( ) ,
7+ id : text ( "id" ) . $type < AccountID > ( ) . primaryKey ( ) ,
8+ email : text ( "email" ) . notNull ( ) ,
9+ url : text ( "url" ) . notNull ( ) ,
10+ access_token : text ( "access_token" ) . $type < AccessToken > ( ) . notNull ( ) ,
11+ refresh_token : text ( "refresh_token" ) . $type < RefreshToken > ( ) . notNull ( ) ,
12+ token_expiry : integer ( "token_expiry" ) ,
1313 ...Timestamps ,
1414} )
1515
1616export const AccountStateTable = sqliteTable ( "account_state" , {
17- id : integer ( ) . primaryKey ( ) ,
18- active_account_id : text ( )
17+ id : integer ( "id" ) . primaryKey ( ) ,
18+ active_account_id : text ( "active_account_id" )
1919 . $type < AccountID > ( )
2020 . references ( ( ) => AccountTable . id , { onDelete : "set null" } ) ,
21- active_org_id : text ( ) . $type < OrgID > ( ) ,
21+ active_org_id : text ( "active_org_id" ) . $type < OrgID > ( ) ,
2222} )
2323
2424// LEGACY
2525export const ControlAccountTable = sqliteTable (
2626 "control_account" ,
2727 {
28- email : text ( ) . notNull ( ) ,
29- url : text ( ) . notNull ( ) ,
30- access_token : text ( ) . $type < AccessToken > ( ) . notNull ( ) ,
31- refresh_token : text ( ) . $type < RefreshToken > ( ) . notNull ( ) ,
32- token_expiry : integer ( ) ,
33- active : integer ( { mode : "boolean" } )
28+ email : text ( "email" ) . notNull ( ) ,
29+ url : text ( "url" ) . notNull ( ) ,
30+ access_token : text ( "access_token" ) . $type < AccessToken > ( ) . notNull ( ) ,
31+ refresh_token : text ( "refresh_token" ) . $type < RefreshToken > ( ) . notNull ( ) ,
32+ token_expiry : integer ( "token_expiry" ) ,
33+ active : integer ( "active" , { mode : "boolean" } )
3434 . notNull ( )
3535 . $default ( ( ) => false ) ,
3636 ...Timestamps ,
3737 } ,
38- ( table ) => [ primaryKey ( { columns : [ table . email , table . url ] } ) ] ,
38+ ( table ) => ( { pk : primaryKey ( { columns : [ table . email , table . url ] } ) } ) ,
3939)
0 commit comments