Reputation: 1948
I have a simple grails app I started to write. So far I only have a few domain classes, no other artefacts. Yesterday I ran the only one integration test I have and it passed. Today when I run it I get this output:
2015-04-23 11:07:37,000 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: create table or
der (id bigint generated by default as identity, version bigint not null, customer_id bigi
nt not null, date_created timestamp not null, total float not null, primary key (id))
Error |
2015-04-23 11:07:37,002 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"CREATE TABLE ORDER[*] (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NU
LL, CUSTOMER_ID BIGINT NOT NULL, DATE_CREATED TIMESTAMP NOT NULL, TOTAL FLOAT NOT NULL, PR
IMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table order (id bigint generated by default as identity, version bigint not null, c
ustomer_id bigint not null, date_created timestamp not null, total float not null, primary
key (id)) [42001-173]
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er add constraint FK651874E6A961CB1 foreign key (customer_id) references customer
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER[*] ADD CONSTRAINT FK651874E6A961CB1 FOREIGN KEY (CUSTOMER_ID) REFERENC
ES CUSTOMER "; expected "identifier"; SQL statement:
alter table order add constraint FK651874E6A961CB1 foreign key (customer_id) references cu
stomer [42001-173]
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er_item add constraint FK2D110D6455275AA3 foreign key (order_id) references order
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER_ITEM ADD CONSTRAINT FK2D110D6455275AA3 FOREIGN KEY (ORDER_ID) REFERENC
ES ORDER[*] "; expected "identifier"; SQL statement:
alter table order_item add constraint FK2D110D6455275AA3 foreign key (order_id) references
order [42001-173]
.......
|Compiling 1 source files
..
|Tests PASSED - view reports in C:\Users
And when I open the HTML test results page, it says no tests were executed. I even tried grails clean-all
. At this point my project is just starting so I can easily create a new app and copy my code over to that but I would love to know what is wrong with this app. Yesterday this test ran fine and passed, all I did was close my IDE and started it again today. I even closed the ide and tried to run the test from the command prompt with same bad results.
In case anyone wants to see the code, it's here
Upvotes: 0
Views: 121
Reputation: 50285
Modifying dbCreate = "update"
to dbCreate = "create-drop"
in DataSource.groovy
under test environment (precisely here) should fix this issue.
Basically it would recreate db in between tests which would be a cleaner approach during tests.
Upvotes: 2