[ISC-support #19985] Fix database migration in Stork 1.0.0
The database migration 37, among other things, does this:
... DELETE FROM host; ... -- Add a missing foreign key to host table. ALTER TABLE local_host ADD CONSTRAINT local_host_to_host_id FOREIGN KEY (host_id) REFERENCES host (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE;
The first statement relies on the presence of the foreign key which is added later. This causes constraint violation issues when people migrate databases that include host reservations. The order of these operations must be swapped.
Current workaround for this issue is to manually run:
DELETE FROM local_host;