I have an application which creates its tables as needed on format changes. When the tables do not pass a simple functionality test, they are dropped and created again. This has worked great so far, but now I have changed some constraints: I have changed a primary key and added a foreign key.
The drop now fails with exception:
org.h2.jdbc.JdbcSQLException: Constraint "PERSON_ID" not found; SQL statement:
alter table "GARDEN" drop constraint "PERSON_ID" [90057-178]
The drop statement is as follows:
alter table "GARDEN" drop constraint "PERSON_ID"
alter table "GARDEN" drop constraint "PRIMARY_KEY"
drop table "GARDEN"
The trouble is this drop statement would be valid for the desired table format, but is invalid for the format used before (which is the format of the table which was detected as unusuable and triggered the drop to be done).
How can I drop the tables with no regard to the constraints? (I am always dropping all tables which are related - therefore I do not need the constraint checking in this case)