@@ -425,7 +425,7 @@ impl Inner {
425425 & st_sequences_schema ( ) ,
426426 ) ;
427427 let row = StSequenceRow {
428- sequence_id : seq_id. 0 ,
428+ sequence_id : seq_id,
429429 sequence_name : & format ! ( "{}_seq" , col. col_name) ,
430430 table_id : col. table_id ,
431431 col_id : col. col_id ,
@@ -529,9 +529,7 @@ impl Inner {
529529 seq. value = sequence. allocated + 1 ;
530530 }
531531
532- self . sequence_state
533- . sequences
534- . insert ( SequenceId ( sequence. sequence_id ) , seq) ;
532+ self . sequence_state . sequences . insert ( sequence. sequence_id , seq) ;
535533 }
536534 Ok ( ( ) )
537535 }
@@ -659,7 +657,7 @@ impl Inner {
659657 // NOTE: Because st_sequences has a unique index on sequence_name, this will
660658 // fail if the table already exists.
661659 let sequence_row = StSequenceRow {
662- sequence_id : 0 , // autogen'd
660+ sequence_id : SequenceId ( 0 ) , // autogen'd
663661 sequence_name : seq. sequence_name . as_str ( ) ,
664662 table_id : seq. table_id ,
665663 col_id : seq. col_id ,
@@ -672,7 +670,7 @@ impl Inner {
672670 let row = ( & sequence_row) . into ( ) ;
673671 let result = self . insert ( ST_SEQUENCES_ID , row) ?;
674672 let sequence_row = StSequenceRow :: try_from ( & result) ?;
675- let sequence_id = SequenceId ( sequence_row. sequence_id ) ;
673+ let sequence_id = sequence_row. sequence_id ;
676674
677675 let schema = ( & sequence_row) . into ( ) ;
678676 self . sequence_state . sequences . insert ( sequence_id, Sequence :: new ( schema) ) ;
@@ -908,7 +906,7 @@ impl Inner {
908906 for data_ref in rows {
909907 let row = data_ref. view ( ) ;
910908 let el = StSequenceRow :: try_from ( row) ?;
911- self . drop_sequence ( SequenceId ( el. sequence_id ) ) ?;
909+ self . drop_sequence ( el. sequence_id ) ?;
912910 }
913911
914912 // Remove the table's columns from st_columns.
@@ -1198,7 +1196,7 @@ impl Inner {
11981196 if seq_row. col_id != col. col_id {
11991197 continue ;
12001198 }
1201- let sequence_value = self . get_next_sequence_value ( SequenceId ( seq_row. sequence_id ) ) ?;
1199+ let sequence_value = self . get_next_sequence_value ( seq_row. sequence_id ) ?;
12021200 row. elements [ col. col_id . idx ( ) ] = Self :: sequence_value_to_algebraic_value (
12031201 & schema. table_name ,
12041202 & col. col_name ,
@@ -2164,7 +2162,7 @@ mod tests {
21642162 error:: ResultTest ,
21652163 ColumnIndexAttribute ,
21662164 } ;
2167- use spacetimedb_primitives:: { IndexId , TableId } ;
2165+ use spacetimedb_primitives:: { IndexId , TableId , SequenceId } ;
21682166 use spacetimedb_sats:: { product, AlgebraicType , AlgebraicValue , ProductValue } ;
21692167
21702168 fn u32_str_u32 ( a : u32 , b : & str , c : u32 ) -> ProductValue {
@@ -2387,10 +2385,10 @@ mod tests {
23872385 assert_eq ! (
23882386 sequence_rows,
23892387 vec![
2390- StSequenceRow { sequence_id: 0 , sequence_name: "table_id_seq" . to_string( ) , table_id: TableId ( 0 ) , col_id: ColId ( 0 ) , increment: 1 , start: 6 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2391- StSequenceRow { sequence_id: 1 , sequence_name: "sequence_id_seq" . to_string( ) , table_id: TableId ( 2 ) , col_id: ColId ( 0 ) , increment: 1 , start: 4 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2392- StSequenceRow { sequence_id: 2 , sequence_name: "index_id_seq" . to_string( ) , table_id: TableId ( 3 ) , col_id: ColId ( 0 ) , increment: 1 , start: 6 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2393- StSequenceRow { sequence_id: 3 , sequence_name: "constraint_id_seq" . to_string( ) , table_id: TableId ( 4 ) , col_id: ColId ( 0 ) , increment: 1 , start: 1 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2388+ StSequenceRow { sequence_id: SequenceId ( 0 ) , sequence_name: "table_id_seq" . to_string( ) , table_id: TableId ( 0 ) , col_id: ColId ( 0 ) , increment: 1 , start: 6 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2389+ StSequenceRow { sequence_id: SequenceId ( 1 ) , sequence_name: "sequence_id_seq" . to_string( ) , table_id: TableId ( 2 ) , col_id: ColId ( 0 ) , increment: 1 , start: 4 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2390+ StSequenceRow { sequence_id: SequenceId ( 2 ) , sequence_name: "index_id_seq" . to_string( ) , table_id: TableId ( 3 ) , col_id: ColId ( 0 ) , increment: 1 , start: 6 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
2391+ StSequenceRow { sequence_id: SequenceId ( 3 ) , sequence_name: "constraint_id_seq" . to_string( ) , table_id: TableId ( 4 ) , col_id: ColId ( 0 ) , increment: 1 , start: 1 , min_value: 1 , max_value: 4294967295 , allocated: 4096 } ,
23942392 ]
23952393 ) ;
23962394 let constraints_rows = datastore
0 commit comments