@@ -609,9 +609,9 @@ test('create table with rls enabled', async ({ db }) => {
609609 const schema1 = { } ;
610610
611611 const schema2 = {
612- users : cockroachTable ( 'users' , {
612+ users : cockroachTable . withRLS ( 'users' , {
613613 id : int4 ( 'id' ) . primaryKey ( ) ,
614- } ) . enableRLS ( ) ,
614+ } ) ,
615615 } ;
616616
617617 const { sqlStatements : st } = await diff ( schema1 , schema2 , [ ] ) ;
@@ -638,9 +638,9 @@ test('enable rls force', async ({ db }) => {
638638 } ;
639639
640640 const schema2 = {
641- users : cockroachTable ( 'users' , {
641+ users : cockroachTable . withRLS ( 'users' , {
642642 id : int4 ( 'id' ) . primaryKey ( ) ,
643- } ) . enableRLS ( ) ,
643+ } ) ,
644644 } ;
645645
646646 const { sqlStatements : st } = await diff ( schema1 , schema2 , [ ] ) ;
@@ -660,9 +660,9 @@ test('enable rls force', async ({ db }) => {
660660
661661test ( 'disable rls force' , async ( { db } ) => {
662662 const schema1 = {
663- users : cockroachTable ( 'users' , {
663+ users : cockroachTable . withRLS ( 'users' , {
664664 id : int4 ( 'id' ) . primaryKey ( ) ,
665- } ) . enableRLS ( ) ,
665+ } ) ,
666666 } ;
667667
668668 const schema2 = {
@@ -698,9 +698,9 @@ test('drop policy with enabled rls', async ({ db }) => {
698698
699699 const schema2 = {
700700 role,
701- users : cockroachTable ( 'users' , {
701+ users : cockroachTable . withRLS ( 'users' , {
702702 id : int4 ( 'id' ) . primaryKey ( ) ,
703- } ) . enableRLS ( ) ,
703+ } ) ,
704704 } ;
705705
706706 const { sqlStatements : st } = await diff ( schema1 , schema2 , [ ] ) ;
@@ -723,16 +723,16 @@ test('drop policy with enabled rls #2', async ({ db }) => {
723723
724724 const schema1 = {
725725 role,
726- users : cockroachTable ( 'users' , {
726+ users : cockroachTable . withRLS ( 'users' , {
727727 id : int4 ( 'id' ) . primaryKey ( ) ,
728- } , ( ) => [ cockroachPolicy ( 'test' , { to : [ role ] } ) ] ) . enableRLS ( ) ,
728+ } , ( ) => [ cockroachPolicy ( 'test' , { to : [ role ] } ) ] ) ,
729729 } ;
730730
731731 const schema2 = {
732732 role,
733- users : cockroachTable ( 'users' , {
733+ users : cockroachTable . withRLS ( 'users' , {
734734 id : int4 ( 'id' ) . primaryKey ( ) ,
735- } ) . enableRLS ( ) ,
735+ } ) ,
736736 } ;
737737
738738 const { sqlStatements : st } = await diff ( schema1 , schema2 , [ ] ) ;
@@ -753,18 +753,18 @@ test('drop policy with enabled rls #2', async ({ db }) => {
753753
754754test ( 'add policy with enabled rls' , async ( { db } ) => {
755755 const schema1 = {
756- users : cockroachTable ( 'users' , {
756+ users : cockroachTable . withRLS ( 'users' , {
757757 id : int4 ( 'id' ) . primaryKey ( ) ,
758- } ) . enableRLS ( ) ,
758+ } ) ,
759759 } ;
760760
761761 const role = cockroachRole ( 'manager' ) ;
762762
763763 const schema2 = {
764764 role,
765- users : cockroachTable ( 'users' , {
765+ users : cockroachTable . withRLS ( 'users' , {
766766 id : int4 ( 'id' ) . primaryKey ( ) ,
767- } , ( ) => [ cockroachPolicy ( 'test' , { to : [ 'current_user' , role ] } ) ] ) . enableRLS ( ) ,
767+ } , ( ) => [ cockroachPolicy ( 'test' , { to : [ 'current_user' , role ] } ) ] ) ,
768768 } ;
769769
770770 const { sqlStatements : st } = await diff ( schema1 , schema2 , [ ] ) ;
@@ -789,19 +789,19 @@ test('add policy with enabled rls #2', async ({ db }) => {
789789 const role2 = cockroachRole ( 'owner' ) ;
790790 const schema1 = {
791791 role2,
792- users : cockroachTable ( 'users' , {
792+ users : cockroachTable . withRLS ( 'users' , {
793793 id : int4 ( 'id' ) . primaryKey ( ) ,
794- } ) . enableRLS ( ) ,
794+ } ) ,
795795 } ;
796796
797797 const role = cockroachRole ( 'manager' ) ;
798798
799799 const schema2 = {
800800 role2,
801801 role,
802- users : cockroachTable ( 'users' , {
802+ users : cockroachTable . withRLS ( 'users' , {
803803 id : int4 ( 'id' ) . primaryKey ( ) ,
804- } , ( ) => [ cockroachPolicy ( 'test' , { to : [ role2 , role ] } ) ] ) . enableRLS ( ) ,
804+ } , ( ) => [ cockroachPolicy ( 'test' , { to : [ role2 , role ] } ) ] ) ,
805805 } ;
806806
807807 const { sqlStatements : st } = await diff ( schema1 , schema2 , [ ] ) ;
@@ -1079,9 +1079,9 @@ test('unlink non-schema table', async ({ db }) => {
10791079} ) ;
10801080
10811081test ( 'add policy + link non-schema table' , async ( { db } ) => {
1082- const cities = cockroachTable ( 'cities' , {
1082+ const cities = cockroachTable . withRLS ( 'cities' , {
10831083 id : int4 ( 'id' ) . primaryKey ( ) ,
1084- } ) . enableRLS ( ) ;
1084+ } ) ;
10851085
10861086 const schema1 = {
10871087 cities,
0 commit comments