File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ export type CockroachTableWithColumns<T extends TableConfig> =
7373 & T [ 'columns' ]
7474 & InferTableColumnsModels < T [ 'columns' ] >
7575 & {
76+ /** @deprecated use `cockroachTable.withRLS()` instead*/
7677 enableRLS : ( ) => Omit <
7778 CockroachTableWithColumns < T > ,
7879 'enableRLS'
Original file line number Diff line number Diff line change @@ -65,7 +65,14 @@ export type PgTableWithColumns<
6565> =
6666 & PgTable < T >
6767 & T [ 'columns' ]
68- & InferTableColumnsModels < T [ 'columns' ] > ;
68+ & InferTableColumnsModels < T [ 'columns' ] >
69+ & {
70+ /** @deprecated use `pgTable.withRLS()` instead*/
71+ enableRLS : ( ) => Omit <
72+ PgTableWithColumns < T > ,
73+ 'enableRLS'
74+ > ;
75+ } ;
6976
7077/** @internal */
7178export function pgTableWithSchema <
@@ -123,7 +130,17 @@ export function pgTableWithSchema<
123130 table [ PgTable . Symbol . ExtraConfigBuilder ] = extraConfig as any ;
124131 }
125132
126- return table as any ;
133+ return Object . assign ( table , {
134+ enableRLS : ( ) => {
135+ table [ PgTable . Symbol . EnableRLS ] = true ;
136+ return table as PgTableWithColumns < {
137+ name : TTableName ;
138+ schema : TSchemaName ;
139+ columns : BuildColumns < TTableName , TColumnsMap , 'pg' > ;
140+ dialect : 'pg' ;
141+ } > ;
142+ } ,
143+ } ) as any ;
127144}
128145
129146export interface PgTableFnInternal < TSchema extends string | undefined = undefined > {
You can’t perform that action at this time.
0 commit comments