Trim derivation source file tables in the small data dump
This commit is contained in:
parent
24e7df541b
commit
b64e6b19c2
1 changed files with 30 additions and 0 deletions
|
|
@ -120,6 +120,28 @@ wait
|
|||
|
||||
psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U guix_data_service <<EOF &
|
||||
|
||||
CREATE UNLOGGED TABLE tmp_derivation_source_files AS
|
||||
SELECT *
|
||||
FROM derivation_source_files
|
||||
WHERE id IN (
|
||||
SELECT derivation_source_file_id
|
||||
FROM tmp_derivation_sources
|
||||
);
|
||||
|
||||
CREATE UNLOGGED TABLE tmp_derivation_source_file_nars AS
|
||||
SELECT *
|
||||
FROM derivation_source_file_nars
|
||||
WHERE derivation_source_file_id IN (
|
||||
SELECT id FROM tmp_derivation_source_files
|
||||
);
|
||||
|
||||
TRUNCATE derivation_source_files CASCADE; -- Cascades to derivation_sources
|
||||
TRUNCATE derivation_source_file_nars;
|
||||
|
||||
EOF
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U guix_data_service <<EOF &
|
||||
|
||||
DELETE FROM guix_revision_lint_warnings WHERE guix_revision_id NOT IN (
|
||||
SELECT id FROM guix_revisions WHERE commit IN (SELECT commit FROM git_branches)
|
||||
);
|
||||
|
|
@ -199,8 +221,14 @@ INSERT INTO derivation_outputs OVERRIDING SYSTEM VALUE
|
|||
INSERT INTO derivation_inputs
|
||||
SELECT * FROM tmp_derivation_inputs;
|
||||
|
||||
INSERT INTO derivation_source_files OVERRIDING SYSTEM VALUE
|
||||
SELECT * FROM tmp_derivation_source_files;
|
||||
|
||||
INSERT INTO derivation_sources
|
||||
SELECT * FROM tmp_derivation_sources;
|
||||
|
||||
INSERT INTO derivation_source_file_nars
|
||||
SELECT * FROM tmp_derivation_source_file_nars;
|
||||
EOF
|
||||
|
||||
psql -v ON_ERROR_STOP=1 --echo-queries --no-psqlrc "$URI_FOR_DATABASE" -U guix_data_service <<EOF
|
||||
|
|
@ -213,6 +241,8 @@ DROP TABLE tmp_build_status;
|
|||
DROP TABLE tmp_derivation_outputs;
|
||||
DROP TABLE tmp_derivation_inputs;
|
||||
DROP TABLE tmp_derivation_sources;
|
||||
DROP TABLE tmp_derivation_source_files;
|
||||
DROP TABLE tmp_derivation_source_file_nars;
|
||||
|
||||
EOF
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue