I'm trying to write an equivalent of Rails data model evolution/rollback mechanism using Spring Jdbc.
Spring Jdbc transactionnal insert/replace
works very well (DataSourceTransactionManager with PROPAGATION_REQUIRED under InnoDB mysql 5) :
// Transaction begins
getJdbcTemplate().execute("replace into aTable ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("replace into aTable ...");
// none are commited
but alter
doesn't :
// Transaction begins
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
getJdbcTemplate().execute("wrong request");
getJdbcTemplate().execute("alter table aTable add column `columnForTest` ...");
// the first alter is commited
Is there a way to achieve atomicity (all-or-none behavior) with alter
?
Thanks in advance