@@ -70,9 +70,15 @@ fn name_for_field_or_child(name: &Option<String>) -> String {
7070pub enum Storage {
7171 /// the field is stored as a column in the parent table
7272 Column { name : String } ,
73- /// the field is stored in a link table, and may or may not have an
74- /// associated index column
75- Table { name : String , has_index : bool } ,
73+ /// the field is stored in a link table
74+ Table {
75+ /// the name of the table
76+ name : String ,
77+ /// the name of the column for the field in the dbscheme
78+ column_name : String ,
79+ /// does it have an associated index column?
80+ has_index : bool ,
81+ } ,
7682}
7783
7884pub fn read_node_types ( node_types_path : & Path ) -> std:: io:: Result < NodeTypeMap > {
@@ -206,12 +212,11 @@ fn add_field(
206212 token_kinds : & Set < TypeName > ,
207213) {
208214 let parent_flattened_name = node_type_name ( & parent_type_name. kind , parent_type_name. named ) ;
215+ let column_name = escape_name ( & name_for_field_or_child ( & field_name) ) ;
209216 let storage = if !field_info. multiple && field_info. required {
210217 // This field must appear exactly once, so we add it as
211218 // a column to the main table for the node type.
212- Storage :: Column {
213- name : escape_name ( & name_for_field_or_child ( & field_name) ) ,
214- }
219+ Storage :: Column { name : column_name }
215220 } else {
216221 // Put the field in an auxiliary table.
217222 let has_index = field_info. multiple ;
@@ -223,6 +228,7 @@ fn add_field(
223228 Storage :: Table {
224229 has_index,
225230 name : field_table_name,
231+ column_name,
226232 }
227233 } ;
228234 let converted_types = convert_types ( & field_info. types ) ;
0 commit comments