write-upgrade-sql-script — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited write-upgrade-sql-script (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Since PrestaShop 9.x, upgrade SQL scripts are not in the core repository. They live in the autoupgrade module: https://github.com/PrestaShop/autoupgrade (see upgrade/sql/{version}.sql). This skill describes what to write; the file lands in autoupgrade. Agents working in core should hand the change off to a maintainer or open the PR against autoupgrade directly.
Whenever a change merged into core needs an existing shop to apply a database modification at upgrade time. Common cases:
ps_configuration, a new row in ps_feature_flag, etc., that newly-installed shops get from the XML/install fixtures but existing shops do not.A new install reads the install fixtures directly; only upgrading shops need this script.
upgrade/sql/{version}.sql in the autoupgrade module repo.-- Add column only if it doesn't exist (MySQL 8.0+ supports IF NOT EXISTS on ALTER TABLE ADD COLUMN)
ALTER TABLE `PREFIX_xxx`
ADD COLUMN IF NOT EXISTS `new_field` INT(11) NOT NULL DEFAULT 0;
-- Create table only if it doesn't exist
CREATE TABLE IF NOT EXISTS `PREFIX_xxx_yyy` (
`id_xxx` INT(11) UNSIGNED NOT NULL,
`id_yyy` INT(11) UNSIGNED NOT NULL,
PRIMARY KEY (`id_xxx`, `id_yyy`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8mb4;-- Insert configuration row only if not present (preserves merchant overrides)
INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`)
SELECT 'PS_NEW_OPTION', '1', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM `PREFIX_configuration` WHERE `name` = 'PS_NEW_OPTION');-- Promote flag to stable + enable it for existing installs
UPDATE `PREFIX_feature_flag`
SET `state` = 1, `stability` = 'stable'
WHERE `name` = '{domain}';
-- If the flag might be missing on very old installs, also INSERT it
INSERT INTO `PREFIX_feature_flag` (`name`, `state`, `stability`, `label_wording`, `label_domain`, `description_wording`, `description_domain`)
SELECT '{domain}', 1, 'stable', 'Use new {Domain} page', 'Admin.Advparameters.Feature', 'Enables the new Symfony page for {Domain}', 'Admin.Advparameters.Help'
WHERE NOT EXISTS (SELECT 1 FROM `PREFIX_feature_flag` WHERE `name` = '{domain}');autoupgrade substitutes it.autoupgrade substitutes it.feature_flag.xml, configuration.xml, etc.) so new installs get it natively.;.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.