aboutsummaryrefslogtreecommitdiff
path: root/sqitch/deploy/remove_old_cross_derivations.sql
blob: b0356736bc46cfd934036af97161a0a2d120e2a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-- Deploy guix-data-service:remove_old_cross_derivations to pg

BEGIN;

DELETE FROM guix_revision_package_derivations WHERE package_derivation_id IN (
  SELECT id
  FROM package_derivations
  WHERE target IN (
    'aarch64-linux',
    'armhf-linux',
    'i686-linux',
    'mips64el-linux',
    'x86_64-linux'
  )
);

-- Checking this constraint is expensive, so drop it, then re-create it
ALTER TABLE guix_revision_package_derivations DROP CONSTRAINT guix_revision_package_derivations_package_derivation_id_fkey;

DELETE FROM package_derivations WHERE target IN (
  'aarch64-linux',
  'armhf-linux',
  'i686-linux',
  'mips64el-linux',
  'x86_64-linux'
);

ALTER TABLE guix_revision_package_derivations ADD CONSTRAINT "guix_revision_package_derivations_package_derivation_id_fkey" FOREIGN KEY (package_derivation_id) REFERENCES package_derivations(id);

COMMIT;