Hi Roger,

Thanks for the feedback. I'll comment inline:

2016-05-08 17:02 GMT+02:00 RIT <[email protected]>:

> Now for a longer reply
>
> I've spent some time trying to link Flyway and JOOQ so that it looks clean
> and 'right' and below are just some comments about what does not look
> 'right' rather than there being any real issues.
>
> Flyway
>
> So far the only real issue I have found is that Flyway's design is that of
> a two step process, first get a checksum value for the migration step and
> then if needed process the migration or report an issue if the checksum is
> not the same as already recorded. This works well if the DDL is static as
> you can just checksum the script file. It does not work so well if there is
> a programmatic process to be followed as the process has to generate a
> checksum from a trial run. The work around is for the trial run to be
> started from within the checksum routine, while a valid solution it does
> mean that Flyway is not fully in control of the 'life cycle', but its a
> minor issue.
>

Just an idea: If you're using jOOQ for migrations with Flyway, the jOOQ
code is really also just a text file (*.java). Taking the checksum of that
would be easy. If you could manage to compile (and run) the jOOQ code after
taking the checksum, that might work around your issue, no? Perhaps, that
might be something worth requesting from Flyway as an enhancement. The
ability to provide programmatic migrations in source format, letting Flyway
compile the migration using the JDK's built-in compiler...

Or, we build that on our end and ship a jOOQ-migrations module based on
Flyway, as I've mentioned before.

JOOQ
>
> The fun starts if you wish to maintain JOOQ's fluent interface as there is
> a need to 2 things that I doubt anyone has asked for before
>
>   - The ability to conditionally execute a modeled SQL statement (in this
> case DDL) so that things like the hashCode can be correctly generated for
> the checksum step.
>   - Return additional information from within the single fluent structure.
> (if that is even the correct term)
>
> As a concrete example consider the following 'idea'
>
>                     create.createTable("tableName")
>                     .column("first", SQLDataType.BIT)
>                     .column("second", SQLDataType.TINYINT)
>                     .hashCode(hashResult)                               //
> place the hash into an object (pass by ref workaround)
>                     .getSQL(sqlResult)
> // place the SQL String into an object (pass by ref workaround)
>
> .execute(condition);                                    // execute only if
> the condition is true
>

You could do something along the lines of:

Query query = create.createTable("...").column("...").column("...");
Runnable[] result = {
    () -> query.hashCode(),
    () -> query.getSQL(),
    () -> query.execute()
};


And then work on that. Not sure if that responds to your concerns,
though...?

-- 
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