Skip to content

Commit f74b83f

Browse files
authored
Merge pull request #207 from ioito/hotfix/qx-clickhouse-table-info
fix: clickhouse table
2 parents 50ff09e + 7ce31f4 commit f74b83f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

backends/clickhouse/clickhouse.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,17 @@ func (click *SClickhouseBackend) GetCreateSQLs(ts sqlchemy.ITableSpec) []string
123123
var ttlCol IClickhouseColumnSpec
124124
for _, c := range ts.Columns() {
125125
cols = append(cols, c.DefinitionString())
126+
if c.IsPrimary() {
127+
primaries = append(primaries, fmt.Sprintf("`%s`", c.Name()))
128+
}
126129
if cc, ok := c.(IClickhouseColumnSpec); ok {
130+
if cc.IsOrderBy() {
131+
orderbys = append(orderbys, fmt.Sprintf("`%s`", c.Name()))
132+
}
127133
partition := cc.PartitionBy()
128134
if len(partition) > 0 && !utils.IsInStringArray(partition, partitions) {
129135
partitions = append(partitions, partition)
130136
}
131-
if c.IsPrimary() && len(partition) == 0 {
132-
primaries = append(primaries, fmt.Sprintf("`%s`", c.Name()))
133-
}
134-
if cc.IsOrderBy() && len(partition) == 0 {
135-
orderbys = append(orderbys, fmt.Sprintf("`%s`", c.Name()))
136-
}
137137
ttlC, ttlU := cc.GetTTL()
138138
if ttlC > 0 && len(ttlU) > 0 {
139139
ttlCol = cc

0 commit comments

Comments
 (0)