Bug 35380: (QA follow-up) Fix data migration for pre-existing record sources

INSERT IGNORE silently skips rows whose name already exists, leaving
their is_system column at 0. Systems that already had 'intranet',
'z3950' etc. as record sources would not have them protected from
deletion. Added an explicit UPDATE after the INSERT to ensure all
known system record source names have is_system=1 regardless of
whether the row was just inserted or already existed.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-03-25 10:11:28 +01:00
parent 75d88eb36c
commit 38c7696866
No known key found for this signature in database
GPG Key ID: 2D86E0EAEC83711B
1 changed files with 10 additions and 0 deletions

View File

@ -39,5 +39,15 @@ return {
('import_lexile', 1, 1 )
}
);
# Ensure pre-existing rows with these names are also marked as system records.
# INSERT IGNORE above skips duplicate names, so existing rows would retain is_system=0.
$dbh->do(
q{
UPDATE record_sources SET is_system = 1
WHERE name IN ('batchmod', 'intranet', 'batchimport', 'z3950', 'bulkmarcimport', 'import_lexile')
}
);
say $out "Marked system record sources with is_system=1";
},
};