I have a pretty normal playframework project that implements a number of rest services. 'activator test' runs fine from the command line. When I try to run one of the tests in the debugger in IntelliJ 15, one of my database evolution scripts fails:
12:34:29.031 [main] ERROR play.api.db.evolutions.DefaultEvolutionsApi - Table "TOKEN" not found;SQL statement:
alter table "TOKEN" rename to "POS_TOKEN" [42102-187] [ERROR:42102, SQLSTATE:42S02]
My h2/2.sql looks like this:
# --- !Ups
alter table "TOKEN" rename to "POS_TOKEN";
drop sequence "TOKEN_SEQ" ;
create sequence "POS_TOKEN_SEQ";
# --- !Downs
alter table "POS_TOKEN" rename to "TOKEN";
drop sequence "POS_TOKEN_SEQ" ;
create sequence "TOKEN_SEQ";
The relevant definition of h2/1.sql is
create table token (
id bigint not null,
access_token varchar(255) not null
constraint pk_token primary key (id))
;
This evolution fails only when running in the debugger. When starting the application with 'activator run' the evolution step 2 is executed without error, and the table is renamed correctly. I have verified this using the h2-browser.
I am using IntelliJ 15 Ultimate Edition. The Debug configuration is Class#methodName, VM-arg is -ea, Working dir = $MODULE_DIR$
.
My unit tests that interact with the dabase all extend InMemoryDbTest:
public abstract class InMemoryDbTest {
protected final String fakeUser = "FakeUser";
public FakeApplication app;
@Before
public void before() {
Map<String, String> inMemoryDatabase = Helpers.inMemoryDatabase("h2");
app = Helpers.fakeApplication(inMemoryDatabase);
Helpers.start(app);
}
@After
public void after() {
Helpers.stop(app);
}
}
I am stumped. Any help with solving this issue is appreciated.