HHH-15573 SpannerDialect, schema creation generates SQL containing 'null' instead of the column type

This commit is contained in:
Andrea Boriero 2022-10-06 09:55:34 +02:00 committed by Andrea Boriero
parent 1fd5f29dcf
commit 0198e5b3c8
1 changed files with 6 additions and 5 deletions

View File

@ -63,10 +63,10 @@ class SpannerDialectTableExporter implements Exporter<Table> {
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( "," ) );
@ -75,10 +75,11 @@ class SpannerDialectTableExporter implements Exporter<Table> {
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 );
}