有没有办法使用JOOQ从Java代码生成SQLite数据库模型?
答案 0 :(得分:1)
您可以使用DSLContext.ddl()
API生成CREATE TABLE ..
或ALTER TABLE .. ADD CONSTRAINT ..
等DDL语句,例如:
// SCHEMA is the generated schema that contains a reference to all generated tables
Queries ddl =
DSL.using(configuration)
.ddl(SCHEMA);
for (Query query : ddl.queries()) {
System.out.println(query);
}
这里有记录: https://www.jooq.org/doc/latest/manual/sql-building/ddl-statements/generating-ddl/