@@ -3,7 +3,7 @@ use crate::execution_context::ExecutionContext;
33use anyhow:: Context ;
44use nonempty:: NonEmpty ;
55use spacetimedb_lib:: auth:: { StAccess , StTableType } ;
6- use spacetimedb_lib:: relation:: { DbTable , FieldName , FieldOnly , Header , TableField } ;
6+ use spacetimedb_lib:: relation:: { Column , DbTable , FieldName , FieldOnly , Header , TableField } ;
77use spacetimedb_lib:: { ColumnIndexAttribute , DataKey , Hash } ;
88use spacetimedb_primitives:: { ColId , IndexId , SequenceId , TableId } ;
99use spacetimedb_sats:: product_value:: InvalidFieldError ;
@@ -249,7 +249,7 @@ impl From<&TableSchema> for ProductType {
249249impl From < & TableSchema > for SourceExpr {
250250 fn from ( value : & TableSchema ) -> Self {
251251 SourceExpr :: DbTable ( DbTable :: new (
252- Header :: from_product_type ( value. table_name . clone ( ) , value . into ( ) ) ,
252+ value. into ( ) ,
253253 value. table_id ,
254254 value. table_type ,
255255 value. table_access ,
@@ -265,7 +265,19 @@ impl From<&TableSchema> for DbTable {
265265
266266impl From < & TableSchema > for Header {
267267 fn from ( value : & TableSchema ) -> Self {
268- Header :: from_product_type ( value. table_name . clone ( ) , value. into ( ) )
268+ Header :: new (
269+ value. table_name . clone ( ) ,
270+ value
271+ . columns
272+ . iter ( )
273+ . map ( |x| {
274+ let field = FieldName :: named ( & value. table_name , & x. col_name ) ;
275+ let is_indexed = value. get_index_by_field ( & field) . is_some ( ) ;
276+
277+ Column :: new ( field, x. col_type . clone ( ) , x. col_id , is_indexed)
278+ } )
279+ . collect ( ) ,
280+ )
269281 }
270282}
271283
0 commit comments