This Docker setup provides multiple PHP and MySQL version combinations for testing DBDiff across different environments.
The Docker setup is configurable via environment variables. Copy .env.example to .env and customize:
cp .env.example .env
# Edit .env to customize ports, database credentials, timeouts, etc.
Key configuration options:
DB_PORT_MYSQL80, DB_PORT_MYSQL84, DB_PORT_MYSQL93 - Database portsPHPMYADMIN_PORT_MYSQL80, PHPMYADMIN_PORT_MYSQL84, PHPMYADMIN_PORT_MYSQL93 - PHPMyAdmin portsDB_ROOT_PASSWORD, DB_USER, DB_PASSWORD, DB_NAME - Database credentialsDATABASE_STARTUP_TIMEOUT, PHPUNIT_TEST_TIMEOUT - Timeout configurationscli-php74-mysql80 - PHP 7.4 with MySQL 8.0cli-php74-mysql84 - PHP 7.4 with MySQL 8.4cli-php74-mysql93 - PHP 7.4 with MySQL 9.3cli-php83-mysql80 - PHP 8.3 with MySQL 8.0cli-php83-mysql84 - PHP 8.3 with MySQL 8.4cli-php83-mysql93 - PHP 8.3 with MySQL 9.3cli-php84-mysql80 - PHP 8.4 with MySQL 8.0cli-php84-mysql84 - PHP 8.4 with MySQL 8.4cli-php84-mysql93 - PHP 8.4 with MySQL 9.3db-mysql80 - MySQL 8.0 (accessible on localhost:3306)db-mysql84 - MySQL 8.4 (accessible on localhost:3307)db-mysql93 - MySQL 9.3 (accessible on localhost:3308)phpmyadmin-mysql80 - PHPMyAdmin for MySQL 8.0 (http://localhost:8080)phpmyadmin-mysql84 - PHPMyAdmin for MySQL 8.4 (http://localhost:8081)phpmyadmin-mysql93 - PHPMyAdmin for MySQL 9.3 (http://localhost:8082)# Start MySQL 8.0 with PHPMyAdmin
docker-compose up -d db-mysql80 phpmyadmin-mysql80
# Start MySQL 8.4 with PHPMyAdmin
docker-compose up -d db-mysql84 phpmyadmin-mysql84
# Start MySQL 9.3 with PHPMyAdmin
docker-compose up -d db-mysql93 phpmyadmin-mysql93
# PHP 7.4 with MySQL 8.0
docker-compose run --rm cli-php74-mysql80 server1.php server2.php database1 database2
# PHP 8.3 with MySQL 8.0
docker-compose run --rm cli-php83-mysql80 server1.php server2.php database1 database2
# PHP 8.4 with MySQL 8.4
docker-compose run --rm cli-php84-mysql84 server1.php server2.php database1 database2
# PHP 8.4 with MySQL 9.3
docker-compose run --rm cli-php84-mysql93 server1.php server2.php database1 database2
# Run tests with PHP 7.4 and MySQL 8.0
docker-compose run --rm cli-php74-mysql80 phpunit
# Run tests with PHP 8.3 and MySQL 8.0
docker-compose run --rm cli-php83-mysql80 phpunit
# Run tests with PHP 8.4 and MySQL 8.4
docker-compose run --rm cli-php84-mysql84 phpunit
The start.sh script provides an easy way to test different PHP/MySQL combinations with automatic cleanup to save disk space.
# Test specific PHP/MySQL combination
./start.sh 8.3 8.0
# Test all combinations (sequentially)
./start.sh all all
# HIGH PERFORMANCE: Test all combinations in parallel
./start.sh all all --parallel
# RECORD MODE: Update expected test fixtures for all versions
./start.sh all all --record
# FAST RESTART: Skip heavy Docker cleanup for faster iterations
./start.sh 8.3 8.0 --fast
# Watch mode - single combination
./start.sh 8.3 8.0 --watch
# Interactive mode - select from menus
./start.sh
Advanced Flags:
--parallel): Spawns multiple background processes to test different MySQL major versions concurrently. This provides a ~3x speedup when running all all.--fast): Skips the aggressive deletion of Docker images and build caches between runs. Use this when iterating on code and the underlying environment/dependencies haven’t changed.--record): Tunnels the DBDIFF_RECORD_MODE environment variable into the test containers. This will cause tests to overwrite the expected fixtures in tests/expected/ with the actual current output.--watch):
--no-teardown): Containers remain active after script completion (works with both single and watch modes).Test Runner Modes:
--watch):
--no-teardown): Containers remain active after script completion (works with both single and watch modes)“All” Option Behavior:
Note: The start script automatically cleans up Docker containers, images, volumes, and build cache after each test to save disk space (unless –no-teardown is used).
Stop Script:
Use ./stop.sh to manually clean up all containers and resources, especially useful after using --no-teardown:
# Normal cleanup
./stop.sh
# Aggressive cleanup (removes everything)
./stop.sh --aggressive
# Show help
./stop.sh --help
# Start all databases and PHPMyAdmin instances
docker-compose up -d
# Or start specific combination
docker-compose up -d db-mysql80 phpmyadmin-mysql80 cli-php83-mysql80
# Stop all services
docker-compose down
# Remove all containers and images
docker-compose down --rmi all --volumes --remove-orphans
Default MySQL credentials (configurable via .env):
rootpass (DB_ROOT_PASSWORD)diff1 (DB_NAME)dbdiff (DB_USER)dbdiff (DB_PASSWORD)localhost:3306 (DB_PORT_MYSQL80)localhost:3307 (DB_PORT_MYSQL84)localhost:3308 (DB_PORT_MYSQL93)The project uses GitHub Actions to ensure full compatibility across all supported versions on every pull request.
Matrix Grid:
DBDiff is now built with deterministic SQL generation. This means:
ALTER statements within a table (columns, keys, constraints) are sorted by item name.INSERT, UPDATE, DELETE) are sorted by primary key.This ensures that test fixtures are stable across platforms and different database versions.
vendor/ folder.