File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 9494 reValidColumnName = regexp .MustCompile (`^[a-z_][a-z\d_]*$` )
9595)
9696
97+ // AddCqIds adds the cq_id and cq_parent_id columns to the table and all its relations
98+ // set cq_id as primary key if no other primary keys
99+ func AddCqIDs (table * Table ) {
100+ havePks := len (table .PrimaryKeys ()) > 0
101+ cqIDColumn := CqIDColumn
102+ if ! havePks {
103+ cqIDColumn .PrimaryKey = true
104+ }
105+ table .Columns = append (
106+ ColumnList {
107+ cqIDColumn ,
108+ CqParentIDColumn ,
109+ },
110+ table .Columns ... ,
111+ )
112+ for _ , rel := range table .Relations {
113+ AddCqIDs (rel )
114+ }
115+ }
116+
97117func NewTablesFromArrowSchemas (schemas []* arrow.Schema ) (Tables , error ) {
98118 tables := make (Tables , len (schemas ))
99119 for i , schema := range schemas {
You can’t perform that action at this time.
0 commit comments