File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/cubejs-schema-compiler/src/scaffolding/formatters Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,11 @@ import { toSnakeCase } from '../utils';
1313
1414const JOIN_RELATIONSHIP_MAP = {
1515 hasOne : 'one_to_one' ,
16+ has_one : 'one_to_one' ,
1617 hasMany : 'one_to_many' ,
18+ has_many : 'one_to_many' ,
1719 belongsTo : 'many_to_one' ,
20+ belongs_to : 'many_to_one' ,
1821} ;
1922
2023export type SchemaFile = {
@@ -107,7 +110,7 @@ export abstract class BaseSchemaFormatter {
107110 let table = `${
108111 tableSchema . schema ?. length ? `${ this . escapeName ( tableSchema . schema ) } .` : ''
109112 } ${ this . escapeName ( tableSchema . table ) } `;
110-
113+
111114 if ( this . options . catalog ) {
112115 table = `${ this . escapeName ( this . options . catalog ) } .${ table } ` ;
113116 }
@@ -126,7 +129,7 @@ export abstract class BaseSchemaFormatter {
126129 : {
127130 sql : `SELECT * FROM ${ table } ` ,
128131 } ;
129-
132+
130133 return {
131134 cube : tableSchema . cube ,
132135 ...sqlOption ,
@@ -139,7 +142,7 @@ export abstract class BaseSchemaFormatter {
139142 j . thisTableColumn
140143 ) } = ${ this . cubeReference ( j . cubeToJoin ) } .${ this . escapeName ( j . columnToJoin ) } `,
141144 relationship : this . options . snakeCase
142- ? JOIN_RELATIONSHIP_MAP [ j . relationship ]
145+ ? ( JOIN_RELATIONSHIP_MAP [ j . relationship ] ?? j . relationship )
143146 : j . relationship ,
144147 } ,
145148 } ) )
You can’t perform that action at this time.
0 commit comments