@@ -177,11 +177,7 @@ protected void doMigrationToTargets(
177177 }
178178
179179 final TableInformation tableInformation = existingDatabase .getTableInformation ( table .getQualifiedTableName () );
180- if ( tableInformation == null ) {
181- // big problem...
182- throw new SchemaManagementException ( "BIG PROBLEM" );
183- }
184- if ( !tableInformation .isPhysicalTable () ) {
180+ if ( tableInformation != null && !tableInformation .isPhysicalTable () ) {
185181 continue ;
186182 }
187183
@@ -267,9 +263,11 @@ private void applyIndexes(Table table, TableInformation tableInformation, Metada
267263 continue ;
268264 }
269265
270- final IndexInformation existingIndex = findMatchingIndex ( index , tableInformation );
271- if ( existingIndex != null ) {
272- continue ;
266+ if ( tableInformation != null ) {
267+ final IndexInformation existingIndex = findMatchingIndex ( index , tableInformation );
268+ if ( existingIndex != null ) {
269+ continue ;
270+ }
273271 }
274272
275273 applySqlStrings (
@@ -364,19 +362,22 @@ private void applyForeignKeys(
364362 continue ;
365363 }
366364
367- final ForeignKeyInformation existingForeignKey = findMatchingForeignKey ( foreignKey , tableInformation );
365+ if ( tableInformation != null ) {
366+ final ForeignKeyInformation existingForeignKey = findMatchingForeignKey ( foreignKey , tableInformation );
367+ if ( existingForeignKey != null ) {
368+ continue ;
369+ }
370+ }
368371
369372 // todo : shouldn't we just drop+recreate if FK exists?
370373 // this follows the existing code from legacy SchemaUpdate which just skipped
371374
372- if ( existingForeignKey == null ) {
373- // in old SchemaUpdate code, this was the trigger to "create"
374- applySqlStrings (
375- exporter .getSqlCreateStrings ( foreignKey , metadata ),
376- targets ,
377- false
378- );
379- }
375+ // in old SchemaUpdate code, this was the trigger to "create"
376+ applySqlStrings (
377+ exporter .getSqlCreateStrings ( foreignKey , metadata ),
378+ targets ,
379+ false
380+ );
380381 }
381382 }
382383
0 commit comments