aboutsummaryrefslogtreecommitdiff
path: root/sqitch/deploy/remove_odd_package_derivations.sql
blob: 6cee32f6e3251a58ac6b97ae296bfb5dad63496e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- Deploy guix-data-service:remove_odd_package_derivations to pg

BEGIN;

DELETE FROM guix_revision_package_derivations
WHERE package_derivation_id IN (
  SELECT package_derivations.id
  FROM package_derivations
  INNER JOIN derivations
    ON package_derivations.derivation_id = derivations.id
  WHERE package_derivations.system != derivations.system
);

DELETE FROM package_derivations
WHERE id IN (
  SELECT package_derivations.id
  FROM package_derivations
  INNER JOIN derivations
    ON package_derivations.derivation_id = derivations.id
  WHERE package_derivations.system != derivations.system
);

COMMIT;