@@ -127,13 +127,6 @@ export abstract class BaseSchemaFormatter {
127127 ...sqlOption ,
128128 ...dataSourceProp ,
129129
130- [ this . options . snakeCase ? 'pre_aggregations' : 'preAggregations' ] : new ValueWithComments (
131- null ,
132- [
133- 'Pre-aggregation definitions go here' ,
134- 'Learn more here: https://cube.dev/docs/caching/pre-aggregations/getting-started' ,
135- ]
136- ) ,
137130 joins : tableSchema . joins
138131 . map ( ( j ) => ( {
139132 [ j . cubeToJoin ] : {
@@ -146,36 +139,45 @@ export abstract class BaseSchemaFormatter {
146139 } ,
147140 } ) )
148141 . reduce ( ( a , b ) => ( { ...a , ...b } ) , { } ) ,
149- measures : tableSchema . measures
142+ dimensions : tableSchema . dimensions
150143 . map ( ( m ) => ( {
151144 [ this . memberName ( m ) ] : {
152145 sql : this . sqlForMember ( m ) ,
153146 type : m . type ?? m . types [ 0 ] ,
154147 title : this . memberTitle ( m ) ,
148+ [ this . options . snakeCase ? 'primary_key' : 'primaryKey' ] : m . isPrimaryKey
149+ ? true
150+ : undefined ,
155151 } ,
156152 } ) )
157- . reduce ( ( a , b ) => ( { ...a , ...b } ) , {
158- count : {
159- type : 'count' ,
160- } ,
161- } ) ,
162- dimensions : tableSchema . dimensions
153+ . reduce ( ( a , b ) => ( { ...a , ...b } ) , { } ) ,
154+ measures : tableSchema . measures
163155 . map ( ( m ) => ( {
164156 [ this . memberName ( m ) ] : {
165157 sql : this . sqlForMember ( m ) ,
166158 type : m . type ?? m . types [ 0 ] ,
167159 title : this . memberTitle ( m ) ,
168- [ this . options . snakeCase ? 'primary_key' : 'primaryKey' ] : m . isPrimaryKey
169- ? true
170- : undefined ,
171160 } ,
172161 } ) )
173- . reduce ( ( a , b ) => ( { ...a , ...b } ) , { } ) ,
162+ . reduce ( ( a , b ) => ( { ...a , ...b } ) , {
163+ count : {
164+ type : 'count' ,
165+ } ,
166+ } ) ,
167+
174168 ...( this . options . snakeCase
175169 ? Object . fromEntries (
176170 Object . entries ( contextProps ) . map ( ( [ key , value ] ) => [ toSnakeCase ( key ) , value ] )
177171 )
178172 : contextProps ) ,
173+
174+ [ this . options . snakeCase ? 'pre_aggregations' : 'preAggregations' ] : new ValueWithComments (
175+ null ,
176+ [
177+ 'Pre-aggregation definitions go here.' ,
178+ 'Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started' ,
179+ ]
180+ ) ,
179181 } ;
180182 }
181183
0 commit comments