fix(sql): purge stranded legacy remote-storage columns (MySQL 8 safe)
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 8s
Universal: PR Check / Secret Scan (pull_request) Successful in 9s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 34s
Universal: PR Check / Validate PR (pull_request) Failing after 15s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 2s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 15s
Universal: Build & Release / Promote to RC (pull_request) Failing after 17s
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Successful in 1m2s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 1m6s
Generic: Project CI / Tests (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Has been cancelled
Joomla: Extension CI / PHPStan Analysis (pull_request) Has been cancelled
Joomla: Extension CI / Build RC Pre-Release (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Successful in 2s
Joomla: Extension CI / Release Readiness Check (pull_request) Failing after 8s
Universal: PR Check / Secret Scan (pull_request) Successful in 9s
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 34s
Universal: PR Check / Validate PR (pull_request) Failing after 15s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 2s
Joomla: Metadata Validation / Validate Joomla Metadata (pull_request) Successful in 15s
Universal: Build & Release / Promote to RC (pull_request) Failing after 17s
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Successful in 1m2s
Joomla: Extension CI / Lint & Validate (pull_request) Failing after 1m6s
Generic: Project CI / Tests (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.2) (pull_request) Has been cancelled
Joomla: Extension CI / Tests (PHP 8.3) (pull_request) Has been cancelled
Joomla: Extension CI / PHPStan Analysis (pull_request) Has been cancelled
Joomla: Extension CI / Build RC Pre-Release (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report: Scripts Governance (pull_request) Has been cancelled
Generic: Repo Health / Report: Repository Health (pull_request) Has been cancelled
02.52.25.sql used `DROP COLUMN IF EXISTS` (MariaDB-only), which errors on Oracle MySQL 8.x — so on MySQL 8 installs the 26 legacy remote_storage/ftp_*/ sftp_*/gdrive_*/s3_* columns were never dropped, yet Joomla recorded the schema as applied (confirmed on suite.dev: MySQL 8.0.41, all 26 columns still present, 0 profiles with legacy remote data). New 02.56.01 migration removes them portably: an INFORMATION_SCHEMA-gated prepared-statement ALTER that drops all 26 columns where present (plain DROP COLUMN, valid on MySQL 8 + MariaDB) and is a no-op where already gone (so it's safe on already-migrated installs too). Validated non-destructively against suite.dev (gate=1, ALTER PREPAREs cleanly). Claude-Session: https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- Purge legacy single-remote storage columns from installs where they are still present.
|
||||
--
|
||||
-- Background: 02.52.25.sql originally used `DROP COLUMN IF EXISTS`, which is a
|
||||
-- MariaDB-only extension and errors on Oracle MySQL 8.x. On MySQL 8 installs the
|
||||
-- migration failed but Joomla still recorded the schema as applied, leaving all 26
|
||||
-- legacy remote_storage/ftp_*/sftp_*/gdrive_*/s3_* columns stranded on the profiles
|
||||
-- table. This migration removes them portably.
|
||||
--
|
||||
-- It must be safe on BOTH engines AND on installs where the columns are already gone
|
||||
-- (MariaDB, or anyone who ran the corrected 02.52.25). Plain `DROP COLUMN` errors when
|
||||
-- a column is absent, and `DROP COLUMN IF EXISTS` errors on MySQL 8 — so neither works
|
||||
-- unconditionally. We gate the drop on INFORMATION_SCHEMA and build the ALTER via a
|
||||
-- prepared statement, which runs on MySQL 8 and MariaDB alike. All 26 columns were
|
||||
-- created and dropped together, so the presence of `remote_storage` gates the whole set.
|
||||
-- When the columns are absent this is a no-op (`DO 0`).
|
||||
|
||||
SET @moko_has_legacy_remote := (
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = '#__mokosuitebackup_profiles'
|
||||
AND COLUMN_NAME = 'remote_storage'
|
||||
);
|
||||
|
||||
SET @moko_drop_legacy_remote := IF(@moko_has_legacy_remote > 0,
|
||||
'ALTER TABLE `#__mokosuitebackup_profiles` DROP COLUMN `remote_storage`, DROP COLUMN `ftp_host`, DROP COLUMN `ftp_port`, DROP COLUMN `ftp_username`, DROP COLUMN `ftp_password`, DROP COLUMN `ftp_path`, DROP COLUMN `ftp_passive`, DROP COLUMN `ftp_ssl`, DROP COLUMN `sftp_host`, DROP COLUMN `sftp_port`, DROP COLUMN `sftp_username`, DROP COLUMN `sftp_auth_type`, DROP COLUMN `sftp_password`, DROP COLUMN `sftp_key_data`, DROP COLUMN `sftp_passphrase`, DROP COLUMN `sftp_path`, DROP COLUMN `gdrive_client_id`, DROP COLUMN `gdrive_client_secret`, DROP COLUMN `gdrive_refresh_token`, DROP COLUMN `gdrive_folder_id`, DROP COLUMN `s3_endpoint`, DROP COLUMN `s3_region`, DROP COLUMN `s3_access_key`, DROP COLUMN `s3_secret_key`, DROP COLUMN `s3_bucket`, DROP COLUMN `s3_path`',
|
||||
'DO 0'
|
||||
);
|
||||
|
||||
PREPARE moko_stmt FROM @moko_drop_legacy_remote;
|
||||
EXECUTE moko_stmt;
|
||||
DEALLOCATE PREPARE moko_stmt;
|
||||
Reference in New Issue
Block a user