Skip to content

Commit 8ee2fb5

Browse files
committed
Make adding idempotent and add to relations.
1 parent b06ad5c commit 8ee2fb5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

schema/table.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ func AddCqIDs(table *Table) {
130130
// AddCqClientID adds the cq_client_id column to the table,
131131
// which is used to identify the multiplexed client that fetched the resource
132132
func AddCqClientID(t *Table) {
133-
t.Columns = append(ColumnList{CqClientIDColumn}, t.Columns...)
133+
if t.Columns.Get(CqClientIDColumn.Name) == nil {
134+
t.Columns = append(ColumnList{CqClientIDColumn}, t.Columns...)
135+
}
136+
for _, rel := range t.Relations {
137+
AddCqClientID(rel)
138+
}
134139
}
135140

136141
// CqIDAsPK sets the cq_id column as primary key if it exists

0 commit comments

Comments
 (0)