[jOOQ/jOOQ#16825] The code generation initScript property should be able to read from the file system
This commit is contained in:
parent
523e40ce8f
commit
594823bb6a
@ -76,6 +76,7 @@ import javax.sql.DataSource;
|
||||
import org.jooq.Constants;
|
||||
import org.jooq.DSLContext;
|
||||
import org.jooq.Log.Level;
|
||||
import org.jooq.Source;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.jooq.meta.CatalogVersionProvider;
|
||||
import org.jooq.meta.ClassUtils;
|
||||
@ -369,8 +370,13 @@ public class GenerationTool {
|
||||
|
||||
setConnection(c);
|
||||
|
||||
// [#16823] TODO: Move execution logic into the core library
|
||||
if (j.getInitScript() != null)
|
||||
for (String sql : j.getInitScript().split(defaultIfBlank(j.getInitSeparator(), ";")))
|
||||
for (String sql : Source
|
||||
.resolve(j.getInitScript())
|
||||
.readString()
|
||||
.split(defaultIfBlank(j.getInitSeparator(), ";"))
|
||||
)
|
||||
if (!StringUtils.isBlank(sql))
|
||||
ctx.execute(sql);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user