Skip to content

Commit

Permalink
HHH-15573 SpannerDialect, schema creation generates SQL containing 'n…
Browse files Browse the repository at this point in the history
…ull' instead of the column type
  • Loading branch information
dreab8 committed Oct 7, 2022
1 parent 742082a commit 9a9643c
Showing 1 changed file with 6 additions and 5 deletions.
Expand Up @@ -63,10 +63,10 @@ else if ( table.getForeignKeys().size() > 0 ) {
keyColumns = Collections.emptyList();
}

return getTableString( table, keyColumns, context );
return getTableString( table, metadata, keyColumns, context );
}

private String[] getTableString(Table table, Iterable<Column> keyColumns, SqlStringGenerationContext context) {
private String[] getTableString(Table table, Metadata metadata, Iterable<Column> keyColumns, SqlStringGenerationContext context) {
String primaryKeyColNames = StreamSupport.stream( keyColumns.spliterator(), false )
.map( Column::getName )
.collect( Collectors.joining( "," ) );
Expand All @@ -75,10 +75,11 @@ private String[] getTableString(Table table, Iterable<Column> keyColumns, SqlStr


for ( Column column : table.getColumns() ) {
String columnDeclaration =
final String sqlType = column.getSqlType( metadata.getDatabase().getTypeConfiguration(), spannerDialect, metadata );
final String columnDeclaration =
column.getName()
+ " " + column.getSqlType()
+ ( column.isNullable() ? this.spannerDialect.getNullColumnString( column.getSqlType() ) : " not null" );
+ " " + sqlType
+ ( column.isNullable() ? this.spannerDialect.getNullColumnString( sqlType ) : " not null" );
colsAndTypes.add( columnDeclaration );
}

Expand Down

0 comments on commit 9a9643c

Please sign in to comment.