2929import java .util .List ;
3030import java .util .Set ;
3131
32+ import static org .hibernate .internal .util .collections .CollectionHelper .setOfSize ;
3233import static org .hibernate .tool .schema .internal .Helper .applySqlString ;
3334import static org .hibernate .tool .schema .internal .Helper .applySqlStrings ;
3435import static org .hibernate .tool .schema .internal .Helper .createSqlStringGenerationContext ;
@@ -110,9 +111,9 @@ private void truncateFromMetadata(
110111 Formatter formatter ,
111112 GenerationTarget ... targets ) {
112113 final var database = metadata .getDatabase ();
113- SqlStringGenerationContext context = createSqlStringGenerationContext ( options , metadata );
114+ final var context = createSqlStringGenerationContext ( options , metadata );
114115
115- final Set <String > exportIdentifiers = CollectionHelper . setOfSize ( 50 );
116+ final Set <String > exportIdentifiers = setOfSize ( 50 );
116117
117118 for ( var namespace : database .getNamespaces () ) {
118119 if ( schemaFilter .includeNamespace ( namespace ) ) {
@@ -121,19 +122,14 @@ private void truncateFromMetadata(
121122 applySqlString ( dialect .getTableCleaner ().getSqlBeforeString (), formatter , options , targets );
122123
123124 // now it's safe to drop the tables
124- List <Table > list = new ArrayList <>( namespace .getTables ().size () );
125- for ( Table table : namespace .getTables () ) {
126- if ( !table .isPhysicalTable () ) {
127- continue ;
125+ final List <Table > list = new ArrayList <>( namespace .getTables ().size () );
126+ for ( var table : namespace .getTables () ) {
127+ if ( table .isPhysicalTable ()
128+ && schemaFilter .includeTable ( table )
129+ && contributableInclusionFilter .matches ( table ) ) {
130+ checkExportIdentifier ( table , exportIdentifiers );
131+ list .add ( table );
128132 }
129- if ( !schemaFilter .includeTable ( table ) ) {
130- continue ;
131- }
132- if ( !contributableInclusionFilter .matches ( table ) ) {
133- continue ;
134- }
135- checkExportIdentifier ( table , exportIdentifiers );
136- list .add ( table );
137133 }
138134 applySqlStrings (
139135 dialect .getTableCleaner ().getSqlTruncateStrings ( list , metadata , context ),
@@ -175,7 +171,6 @@ private void disableConstraints(
175171 ContributableMatcher contributableInclusionFilter ,
176172 GenerationTarget ... targets ) {
177173 final var dialect = metadata .getDatabase ().getJdbcEnvironment ().getDialect ();
178-
179174 for ( var table : namespace .getTables () ) {
180175 if ( table .isPhysicalTable ()
181176 && schemaFilter .includeTable ( table )
@@ -213,8 +208,8 @@ private void enableConstraints(
213208 SqlStringGenerationContext context ,
214209 ContributableMatcher contributableInclusionFilter ,
215210 GenerationTarget ... targets ) {
216- final Dialect dialect = metadata .getDatabase ().getJdbcEnvironment ().getDialect ();
217- for ( Table table : namespace .getTables () ) {
211+ final var dialect = metadata .getDatabase ().getJdbcEnvironment ().getDialect ();
212+ for ( var table : namespace .getTables () ) {
218213 if ( table .isPhysicalTable ()
219214 && schemaFilter .includeTable ( table )
220215 && contributableInclusionFilter .matches ( table ) ) {
0 commit comments