← ClaudeAtlas

write-upgrade-sql-scriptlisted

Author a SQL upgrade script for shops upgrading to a target PrestaShop version. Covers schema changes, default fixtures / configuration row updates, and feature-flag state transitions.
jeffsenso/prestashop-skills · ★ 4 · API & Backend · score 76
Install: claude install-skill jeffsenso/prestashop-skills
# write-upgrade-sql-script ## Heads-up — cross-repo 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. ## When to use this skill Whenever a change merged into core needs an existing shop to apply a database modification at upgrade time. Common cases: 1. **Schema change** — new table, new column, new index, type change. 2. **Default fixtures / configuration update** — a new row in `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. 3. **Feature-flag state transition** — promoting a flag from beta to stable and enabling it for existing installs. A new install reads the install fixtures directly; only **upgrading** shops need this script. ## Instructions 1. Determine the target PrestaShop version (e.g., 9.1.0). 2. Open or create `upgrade/sql/{version}.sql` in the `autoupgrade` module repo. 3. Append the SQL needed for your change. Use the section that matches your case below. 4. Make every statement **idempotent** — the script may be run more than once and must not error or corrupt data on re-run. ### Case (a) — schema change ```sql -- Add column only if i