Hi Lukas

I was thinking back on the topic and something "hit" me. 

What if the DDL was distinct from the generated POJO?

For example, let's say I could write something close from :

Table table = create.createTable("AUTHOR")
                .addColumn("ID", SQLDataType.INTEGER.nullable(false))
                .addCumn("FIRST_NAME", SQLDataType.VARCHAR.length(50))
                .column("ADDRESS", SQLDataType.VARCHAR.length(50))
                .build();

Then maybe I could do something like ModelUpdater.apply(table);

Then, later on, maybe I could something close to:
Table tablev1 = table.change().removeColumn("ID").addColumn("IDENTIFIER", 
SQLDataType.INTEGER.nullable(false)).build();

And then: 
Schema schemaV1 = Schema.of(tablev1);
Schema changes = Schema.diff().from(Schema.of(table)).to(schemaV1);
ModelUpdater.apply(changes);

And then maybe I could run something like:
GenerationTool.generate(configuration, schemaV1);

What's the big deal?

Well, currently DSLContext.createTable() can just be used to directly act 
on the database.

The idea here is to add a Schema in between, which could be used as well 
for generating stuff in the database but also kept as the meta model. 

Then later on it could be used as a starting for the updated schema. And 
for sure it could be used as well to generate POJO. These nasty Pojos would 
then be purely "record" description, the schema/meta model being kept to 
describe the model.

Actually, I was thinking that such a "schema", with collections of tables, 
procedures and what's not in it, could make easier migration betweens 
schemas (in the case of generated pojos having as well, hard coded, the 
model definition).

Am I definitely too tired and it's all crap or does it make sense somehow ?


Back to the ongoing discussion, I wouldn't go for Maven: control of when 
generation happens it too low IMHO. Actions should happen not at install 
time but on startup (for the db migration work) or on demand for the pojo 
part.

I guess I'll some examples at some point (with 3modules : migration, domain 
and application).

thanks again :)

best
joseph

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to