Database Migrations
Schema updates, SQL migrations
What it is
Database migrations apply schema changes (new tables, columns, indexes) when upgrading WHMDC. Each migration file adds a specific change (e.g. passkeys support, email verification column) and is run once.
How it works
Migration files live in install/sql-files/. Each file typically:
- Adds a new table or column
- Uses
IF NOT EXISTSor checks to avoid errors if already applied - Is recorded in
schema_migrations(or similar) so it is not run twice
Example migration file:
-- activation_pending_verification_migration.sql
ALTER TABLE users ADD COLUMN IF NOT EXISTS email_verified TINYINT(1) DEFAULT 0;
-- Or for MySQL without IF NOT EXISTS, use a procedure to check first
How to set up
- After upgrading WHMDC files, go to Admin → Database Migration (or the equivalent in your install).
- Review pending migrations.
- Click to apply. Migrations run in order.
- Backup your database before running migrations on production.
Manual option: You can also run SQL files from install/sql-files/ manually via phpMyAdmin or MySQL CLI, but ensure you do not run the same migration twice.
Was this helpful?