Skip to content

Commit

Permalink
[#1553] Fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
fivitti committed Oct 30, 2024
1 parent c11b835 commit 10dec6b
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ func init() {
return err
}, func(d migrations.DB) error {
_, err := d.Exec(`
-- Drop the local host entries where the same host is defined in
-- multiple data sources.
DELETE FROM local_host lh
USING (
SELECT host_id, daemon_id
FROM local_host
GROUP BY host_id, daemon_id
HAVING COUNT(*) > 1
) d
WHERE lh.host_id = d.host_id
AND lh.daemon_id = d.daemon_id
AND lh.data_source = 'config';
ALTER TABLE local_host DROP CONSTRAINT local_host_pkey;
ALTER TABLE local_host
ADD CONSTRAINT local_host_pkey
Expand Down

0 comments on commit 10dec6b

Please sign in to comment.