diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 13fc8597b08..323015495c3 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -10,11 +10,67 @@ on: branches: - "*.x" - "master" + schedule: + - cron: "42 3 * * *" jobs: + phpunit-smoke-check: + name: "PHPUnit with SQLite" + runs-on: "ubuntu-20.04" + + strategy: + matrix: + php-version: + - "7.3" + - "7.4" + - "8.0" + deps: + - "fixed" + include: + - deps: "low" + php-version: "7.3" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Install dependencies with composer" + run: "composer install --no-interaction --no-progress --no-suggest" + if: "${{ matrix.deps == 'fixed' }}" + + - name: "Install lowest possible dependencies with composer" + run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-lowest" + if: "${{ matrix.deps == 'low' }}" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "phpunit-sqlite-${{ matrix.deps }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + phpunit-oci8: name: "PHPUnit on OCI8" runs-on: "ubuntu-20.04" + needs: "phpunit-smoke-check" strategy: matrix: @@ -39,6 +95,7 @@ jobs: php-version: "${{ matrix.php-version }}" extensions: "oci8" coverage: "pcov" + ini-values: "zend.assertions=1" - name: "Cache dependencies installed with composer" uses: "actions/cache@v2" @@ -51,14 +108,18 @@ jobs: run: "composer install --no-interaction --no-progress --no-suggest" - name: "Run PHPUnit" - run: "vendor/bin/phpunit -c ci/github/phpunit.oci8.xml --coverage-clover=coverage.xml" + run: "vendor/bin/phpunit -c ci/github/phpunit/oci8.xml --coverage-clover=coverage.xml" - - name: "Upload Code Coverage" - uses: "codecov/codecov-action@v1" + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" phpunit-pdo-oci: name: "PHPUnit on PDO_OCI" runs-on: "ubuntu-20.04" + needs: "phpunit-smoke-check" strategy: matrix: @@ -83,6 +144,371 @@ jobs: php-version: "${{ matrix.php-version }}" extensions: "pdo_oci" coverage: "pcov" + ini-values: "zend.assertions=1" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Install dependencies with composer" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_oci.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + phpunit-postgres: + name: "PHPUnit with PostgreSQL" + runs-on: "ubuntu-20.04" + needs: "phpunit-smoke-check" + + strategy: + matrix: + php-version: + - "7.4" + postgres-version: + - "9.4" + - "9.5" + - "9.6" + - "10" + - "11" + - "12" + - "13" + include: + - php-version: "8.0" + postgres-version: "13" + + services: + postgres: + image: "postgres:${{ matrix.postgres-version }}" + env: + POSTGRES_PASSWORD: "postgres" + + options: >- + --health-cmd "pg_isready" + + ports: + - "5432:5432" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Install dependencies with composer" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/pdo_pgsql.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.postgres-version }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + phpunit-mariadb: + name: "PHPUnit with MariaDB" + runs-on: "ubuntu-20.04" + needs: "phpunit-smoke-check" + + strategy: + matrix: + php-version: + - "7.4" + mariadb-version: + - "10.0" + - "10.1" + - "10.2" + - "10.3" + - "10.4" + - "10.5" + extension: + - "mysqli" + - "pdo_mysql" + include: + - php-version: "8.0" + mariadb-version: "10.5" + extension: "mysqli" + - php-version: "8.0" + mariadb-version: "10.5" + extension: "pdo_mysql" + + services: + mariadb: + image: "mariadb:${{ matrix.mariadb-version }}" + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_DATABASE: "doctrine_tests" + + options: >- + --health-cmd "mysqladmin ping --silent" + + ports: + - "3306:3306" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + extensions: "${{ matrix.extension }}" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Install dependencies with composer" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.mariadb-version }}-${{ matrix.extension }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + + phpunit-mysql: + name: "PHPUnit with MySQL" + runs-on: "ubuntu-20.04" + needs: "phpunit-smoke-check" + + strategy: + matrix: + php-version: + - "7.4" + - "8.0" + mysql-version: + - "5.7" + - "8.0" + extension: + - "mysqli" + - "pdo_mysql" + config-file-suffix: + - "" + include: + - php-version: "7.3" + mysql-version: "8.0" + extension: "mysqli" + custom-entrypoint: >- + --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password" + - php-version: "7.3" + mysql-version: "8.0" + extension: "pdo_mysql" + custom-entrypoint: >- + --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password" + - mysql-version: "5.7" + - mysql-version: "8.0" + # https://stackoverflow.com/questions/60902904/how-to-pass-mysql-native-password-to-mysql-service-in-github-actions + custom-entrypoint: >- + --entrypoint sh mysql:8 -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password" + - config-file-suffix: "-tls" + php-version: "7.4" + mysql-version: "8.0" + extension: "mysqli" + + services: + mysql: + image: "mysql:${{ matrix.mysql-version }}" + + options: >- + --health-cmd "mysqladmin ping --silent" + -e MYSQL_ALLOW_EMPTY_PASSWORD=yes + -e MYSQL_DATABASE=doctrine_tests + ${{ matrix.custom-entrypoint }} + + ports: + - "3306:3306" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + extensions: "${{ matrix.extension }}" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Install dependencies with composer" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Copy TLS-related files" + run: 'docker cp "${{ job.services.mysql.id }}:/var/lib/mysql/ca.pem" . && docker cp "${{ job.services.mysql.id }}:/var/lib/mysql/client-cert.pem" . && docker cp "${{ job.services.mysql.id }}:/var/lib/mysql/client-key.pem" .' + if: "${{ endsWith(matrix.config-file-suffix, 'tls') }}" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}${{ matrix.config-file-suffix }}.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.mysql-version }}-${{ matrix.extension }}-${{ matrix.config-file-suffix }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + phpunit-mssql: + name: "PHPUnit with SQL Server" + runs-on: "ubuntu-20.04" + needs: "phpunit-smoke-check" + + strategy: + matrix: + php-version: + - "7.3" + - "7.4" + extension: + - "sqlsrv" + - "pdo_sqlsrv" + collation: + - "Latin1_General_100_CI_AS" + include: + - collation: "Latin1_General_100_CS_AS" + php-version: "7.4" + extension: "sqlsrv" + - collation: "Latin1_General_100_CS_AS" + php-version: "7.4" + extension: "pdo_sqlsrv" + + services: + mssql: + image: "microsoft/mssql-server-linux:2017-latest" + env: + ACCEPT_EULA: "Y" + SA_PASSWORD: "Doctrine2018" + MSSQL_COLLATION: "${{ matrix.collation }}" + + options: >- + --health-cmd "echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018" + + ports: + - "1433:1433" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + tools: "pecl" + extensions: "${{ matrix.extension }}-5.7.0preview" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Install dependencies with composer" + run: "composer install --no-interaction --no-progress --no-suggest" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/${{ matrix.extension }}.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.extension }}-${{ matrix.php-version }}-${{ matrix.collation }}.coverage" + path: "coverage.xml" + + phpunit-ibm-db2: + name: "PHPUnit with IBM DB2" + runs-on: "ubuntu-18.04" + needs: "phpunit-smoke-check" + + strategy: + matrix: + php-version: + - "7.3" + - "7.4" + + services: + ibm_db2: + image: "ibmcom/db2:11.5.0.0" + env: + DB2INST1_PASSWORD: "Doctrine2018" + LICENSE: "accept" + DBNAME: "doctrine" + + options: "--privileged=true" + + ports: + - "50000:50000" + + steps: + - name: "Perform healthcheck from the outside" + run: "docker logs -f ${{ job.services.ibm_db2.id }} | sed '/(*) Setup has completed./ q'" + + - name: "Create temporary tablespace" + run: "docker exec ${{ job.services.ibm_db2.id }} su - db2inst1 -c 'db2 CONNECT TO doctrine && db2 CREATE USER TEMPORARY TABLESPACE doctrine_tbsp PAGESIZE 4 K'" + + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1,extension=ibm_db2.so, ibm_db2.instance_name=db2inst1" + + - name: "Install ibm_db2 extension" + run: "ci/github/ext/install-ibm_db2.sh ${{ matrix.php-version }}" - name: "Cache dependencies installed with composer" uses: "actions/cache@v2" @@ -95,7 +521,78 @@ jobs: run: "composer install --no-interaction --no-progress --no-suggest" - name: "Run PHPUnit" - run: "vendor/bin/phpunit -c ci/github/phpunit.pdo-oci.xml --coverage-clover=coverage.xml" + run: "vendor/bin/phpunit -c ci/github/phpunit/ibm_db2.xml --coverage-clover=coverage.xml" + + - name: "Upload coverage file" + uses: "actions/upload-artifact@v2" + with: + name: "${{ github.job }}-${{ matrix.php-version }}.coverage" + path: "coverage.xml" + + + development-deps: + name: "PHPUnit with SQLite and development dependencies" + runs-on: "ubuntu-20.04" + + strategy: + matrix: + php-version: + - "7.4" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2" + with: + path: "~/.composer/cache" + key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-locked-" + + - name: "Lower minimum stability" + run: "composer config minimum-stability dev" + + - name: "Install development dependencies with composer" + run: "composer update --no-interaction --no-progress --no-suggest --prefer-dist" + + - name: "Run PHPUnit" + run: "vendor/bin/phpunit -c ci/github/phpunit/sqlite.xml" - - name: "Upload Code Coverage" + upload_coverage: + name: "Upload coverage to Codecov" + runs-on: "ubuntu-20.04" + needs: + - "phpunit-smoke-check" + - "phpunit-oci8" + - "phpunit-pdo-oci" + - "phpunit-postgres" + - "phpunit-mariadb" + - "phpunit-mysql" + - "phpunit-mssql" + - "phpunit-ibm-db2" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + + - name: "Download coverage files" + uses: "actions/download-artifact@v2" + with: + path: "reports" + + - name: "Display structure of downloaded files" + run: ls -R + working-directory: reports + + - name: "Upload to Codecov" uses: "codecov/codecov-action@v1" + with: + directory: reports diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c1cfda3648b..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,215 +0,0 @@ -language: php -dist: bionic - -cache: - directories: - - vendor - - $HOME/.composer/cache - -before_install: - - phpenv config-rm xdebug.ini || true - - pecl install pcov - -before_script: - - | - if [[ -n "$IMAGE" ]] - then - bash ./ci/travis/docker-run-mysql-or-mariadb.sh - fi - -install: - - travis_retry composer -n install --prefer-dist - -script: - - ./vendor/bin/phpunit --configuration ci/travis/$DB.travis.xml --coverage-clover clover.xml - -after_success: - - bash <(curl -s https://codecov.io/bash) - -jobs: - include: - - - stage: Smoke Testing - php: 7.4 - env: DB=sqlite - - - stage: Test - php: 7.3 - env: DB=mysql.docker IMAGE=mysql:5.7 - - stage: Test - php: 7.3 - env: DB=mysql.docker IMAGE=mysql:8.0 - - stage: Test - php: 7.3 - env: DB=mysqli.docker IMAGE=mysql:5.7 - - stage: Test - php: 7.3 - env: DB=mysqli.docker IMAGE=mysql:8.0 - - stage: Test - php: 7.3 - env: DB=mariadb.docker IMAGE=mariadb:10.0 - - stage: Test - php: 7.3 - env: DB=mariadb.docker IMAGE=mariadb:10.1 - - stage: Test - php: 7.3 - env: DB=mariadb.docker IMAGE=mariadb:10.2 - - stage: Test - php: 7.3 - env: DB=mariadb.docker IMAGE=mariadb:10.3 - - stage: Test - php: 7.3 - env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.0 - - stage: Test - php: 7.3 - env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.1 - - stage: Test - php: 7.3 - env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.2 - - stage: Test - php: 7.3 - env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=9.4 - addons: - postgresql: "9.4" - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=9.5 - addons: - postgresql: "9.5" - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=9.6 - addons: - postgresql: "9.6" - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=10.0 - sudo: required - addons: - postgresql: "10" - before_script: - - bash ./ci/travis/install-postgres-10.sh - - stage: Test - php: 7.3 - env: DB=pgsql POSTGRESQL_VERSION=11.0 - sudo: required - before_script: - - bash ./ci/travis/install-postgres-11.sh - - stage: Test - php: 7.3 - env: DB=sqlsrv - sudo: required - before_script: - - bash ./ci/travis/install-sqlsrv-dependencies.sh - - bash ./ci/travis/install-mssql-sqlsrv.sh - - bash ./ci/travis/install-mssql.sh - - stage: Test - php: 7.3 - env: DB=pdo_sqlsrv - sudo: required - before_script: - - bash ./ci/travis/install-sqlsrv-dependencies.sh - - bash ./ci/travis/install-mssql-pdo_sqlsrv.sh - - bash ./ci/travis/install-mssql.sh - - stage: Test - php: 7.3 - env: DB=ibm_db2 - sudo: required - before_script: - - bash ./ci/travis/install-db2.sh - - bash ./ci/travis/install-db2-ibm_db2.sh - - stage: Test - php: 7.3 - env: DB=sqlite DEPENDENCIES=low - install: - - travis_retry composer update --prefer-dist --prefer-lowest - - stage: Test - php: 7.4 - env: DB=mysql.docker IMAGE=mysql:8.0 - - stage: Test - php: 7.4 - env: DB=mysqli-tls.docker IMAGE=mysql:8.0 TLS=yes - - stage: Test - php: 7.4 - env: DB=mariadb.docker IMAGE=mariadb:10.3 - - stage: Test - php: 7.4 - env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 - - stage: Test - php: 7.4 - env: DB=pgsql POSTGRESQL_VERSION=11.0 - sudo: required - before_script: - - bash ./ci/travis/install-postgres-11.sh - - stage: Test - php: 7.4 - env: DB=sqlite - - stage: Test - php: 7.4 - env: DB=sqlsrv MSSQL_COLLATION=Latin1_General_100_CS_AS - sudo: required - before_script: - - bash ./ci/travis/install-sqlsrv-dependencies.sh - - bash ./ci/travis/install-mssql-sqlsrv.sh - - bash ./ci/travis/install-mssql.sh - - stage: Test - php: 7.4 - env: DB=pdo_sqlsrv MSSQL_COLLATION=Latin1_General_100_CS_AS - sudo: required - before_script: - - bash ./ci/travis/install-sqlsrv-dependencies.sh - - bash ./ci/travis/install-mssql-pdo_sqlsrv.sh - - bash ./ci/travis/install-mssql.sh - - - stage: Test - php: nightly - env: DB=mysql.docker IMAGE=mysql:8.0 - - stage: Test - php: nightly - env: DB=mysqli.docker IMAGE=mysql:8.0 - - stage: Test - php: nightly - env: DB=mariadb.docker IMAGE=mariadb:10.3 - - stage: Test - php: nightly - env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 - - stage: Test - php: nightly - env: DB=pgsql POSTGRESQL_VERSION=11.0 - sudo: required - before_script: - - bash ./ci/travis/install-postgres-11.sh - - stage: Test - php: nightly - env: DB=sqlite - - stage: Test - php: nightly - env: DB=sqlsrv - sudo: required - before_script: - - bash ./ci/travis/install-sqlsrv-dependencies.sh - - bash ./ci/travis/install-mssql-sqlsrv.sh - - bash ./ci/travis/install-mssql.sh - - stage: Test - php: nightly - env: DB=pdo_sqlsrv - sudo: required - before_script: - - bash ./ci/travis/install-sqlsrv-dependencies.sh - - bash ./ci/travis/install-mssql-pdo_sqlsrv.sh - - bash ./ci/travis/install-mssql.sh - - - stage: Test - if: type = cron - php: 7.3 - env: DB=sqlite DEPENDENCIES=dev - install: - - composer config minimum-stability dev - - travis_retry composer update --prefer-dist - - allow_failures: - - env: DEPENDENCIES=dev - - php: nightly diff --git a/ci/travis/install-db2-ibm_db2.sh b/ci/github/ext/install-ibm_db2.sh old mode 100644 new mode 100755 similarity index 67% rename from ci/travis/install-db2-ibm_db2.sh rename to ci/github/ext/install-ibm_db2.sh index b59bb6396fd..fa0abc12df7 --- a/ci/travis/install-db2-ibm_db2.sh +++ b/ci/github/ext/install-ibm_db2.sh @@ -5,8 +5,8 @@ set -ex echo "Installing extension" ( # updating APT packages as per support recommendation - sudo apt -y -q update - sudo apt install ksh + sudo apt-get -y -q update + sudo apt-get install ksh php-pear cd /tmp @@ -21,7 +21,6 @@ echo "Installing extension" cd ibm_db2-* phpize ./configure --with-IBM_DB2=/tmp/dsdriver - make -j `nproc` - make install - echo -e 'extension=ibm_db2.so\nibm_db2.instance_name=db2inst1' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/ibm_db2.ini + make -j "$(nproc)" + sudo make install ) diff --git a/ci/travis/ibm_db2.travis.xml b/ci/github/phpunit/ibm_db2.xml similarity index 87% rename from ci/travis/ibm_db2.travis.xml rename to ci/github/phpunit/ibm_db2.xml index 2fe6427fed3..5fc571d7211 100644 --- a/ci/travis/ibm_db2.travis.xml +++ b/ci/github/phpunit/ibm_db2.xml @@ -17,13 +17,13 @@ - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/mysqli-tls.docker.travis.xml b/ci/github/phpunit/mysqli-tls.xml similarity index 88% rename from ci/travis/mysqli-tls.docker.travis.xml rename to ci/github/phpunit/mysqli-tls.xml index f68a7f443f8..6c1435671d7 100644 --- a/ci/travis/mysqli-tls.docker.travis.xml +++ b/ci/github/phpunit/mysqli-tls.xml @@ -10,7 +10,7 @@ - + @@ -25,13 +25,13 @@ - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/mysqli.docker.travis.xml b/ci/github/phpunit/mysqli.xml similarity index 83% rename from ci/travis/mysqli.docker.travis.xml rename to ci/github/phpunit/mysqli.xml index eb1853aa26d..80d91f47a13 100644 --- a/ci/travis/mysqli.docker.travis.xml +++ b/ci/github/phpunit/mysqli.xml @@ -10,20 +10,20 @@ - + - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/github/phpunit.oci8.xml b/ci/github/phpunit/oci8.xml similarity index 91% rename from ci/github/phpunit.oci8.xml rename to ci/github/phpunit/oci8.xml index cae8ab84a03..a1be910ac51 100644 --- a/ci/github/phpunit.oci8.xml +++ b/ci/github/phpunit/oci8.xml @@ -24,13 +24,13 @@ - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/mysql.docker.travis.xml b/ci/github/phpunit/pdo_mysql.xml similarity index 83% rename from ci/travis/mysql.docker.travis.xml rename to ci/github/phpunit/pdo_mysql.xml index c06caf61efc..0fa1e91f65d 100644 --- a/ci/travis/mysql.docker.travis.xml +++ b/ci/github/phpunit/pdo_mysql.xml @@ -10,20 +10,20 @@ - + - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/github/phpunit.pdo-oci.xml b/ci/github/phpunit/pdo_oci.xml similarity index 91% rename from ci/github/phpunit.pdo-oci.xml rename to ci/github/phpunit/pdo_oci.xml index f3e2a9a0a6d..a2b76a6a450 100644 --- a/ci/github/phpunit.pdo-oci.xml +++ b/ci/github/phpunit/pdo_oci.xml @@ -24,13 +24,13 @@ - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/pgsql.travis.xml b/ci/github/phpunit/pdo_pgsql.xml similarity index 82% rename from ci/travis/pgsql.travis.xml rename to ci/github/phpunit/pdo_pgsql.xml index 13ff111bc81..e23494f4ffa 100644 --- a/ci/travis/pgsql.travis.xml +++ b/ci/github/phpunit/pdo_pgsql.xml @@ -11,18 +11,19 @@ + - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/pdo_sqlsrv.travis.xml b/ci/github/phpunit/pdo_sqlsrv.xml similarity index 87% rename from ci/travis/pdo_sqlsrv.travis.xml rename to ci/github/phpunit/pdo_sqlsrv.xml index 707b5ad870c..90405d1a10e 100644 --- a/ci/travis/pdo_sqlsrv.travis.xml +++ b/ci/github/phpunit/pdo_sqlsrv.xml @@ -17,13 +17,13 @@ - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/sqlite.travis.xml b/ci/github/phpunit/sqlite.xml similarity index 83% rename from ci/travis/sqlite.travis.xml rename to ci/github/phpunit/sqlite.xml index 39bab1e665d..7f6c4861452 100644 --- a/ci/travis/sqlite.travis.xml +++ b/ci/github/phpunit/sqlite.xml @@ -9,13 +9,13 @@ > - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/sqlsrv.travis.xml b/ci/github/phpunit/sqlsrv.xml similarity index 87% rename from ci/travis/sqlsrv.travis.xml rename to ci/github/phpunit/sqlsrv.xml index 13d7e8436de..18556435b9f 100644 --- a/ci/travis/sqlsrv.travis.xml +++ b/ci/github/phpunit/sqlsrv.xml @@ -17,13 +17,13 @@ - ../../tests + ../../../tests - ../../src + ../../../src diff --git a/ci/travis/docker-run-mysql-or-mariadb.sh b/ci/travis/docker-run-mysql-or-mariadb.sh deleted file mode 100644 index de0e53b9fcf..00000000000 --- a/ci/travis/docker-run-mysql-or-mariadb.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Starting RDBMS…">&2 - -if [[ "$IMAGE" == "mysql:8.0" ]] -then - CMD_OPTIONS="--default-authentication-plugin=mysql_native_password" -else - CMD_OPTIONS="" -fi - -docker run \ - --health-cmd='mysqladmin ping --silent' \ - --detach \ - --env MYSQL_ALLOW_EMPTY_PASSWORD=yes \ - --env MYSQL_DATABASE=doctrine_tests \ - --publish 33306:3306 \ - --name rdbms \ - "$IMAGE" $CMD_OPTIONS - -while true; do - healthStatus=$(docker inspect --format "{{json .State.Health.Status }}" rdbms) - case $healthStatus in - '"starting"') - echo "Waiting for RDBMS to become ready…">&2 - sleep 1 - ;; - '"healthy"') - echo "Container is healthy">&2 - break - ;; - '"unhealthy"') - echo "Container is unhealthy">&2 - exit 1 - ;; - *) - echo "Unexpected health status $healthStatus">&2 - ;; - esac -done - -if [[ "$TLS" == "yes" ]] -then - for file in "ca.pem" "client-cert.pem" "client-key.pem" - do - docker cp "rdbms:/var/lib/mysql/$file" . - done -fi diff --git a/ci/travis/install-db2.sh b/ci/travis/install-db2.sh deleted file mode 100644 index 79c1be98f74..00000000000 --- a/ci/travis/install-db2.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo Setting up IBM DB2 - -echo "su - db2inst1 -c 'db2 CONNECT TO doctrine && db2 CREATE USER TEMPORARY TABLESPACE doctrine_tbsp PAGESIZE 4 K'" > /tmp/doctrine-init.sh -chmod +x /tmp/doctrine-init.sh - -sudo docker run \ - -d \ - -p 50000:50000 \ - -e DB2INST1_PASSWORD=Doctrine2018 \ - -e LICENSE=accept \ - -e DBNAME=doctrine \ - -v /tmp/doctrine-init.sh:/var/custom/doctrine-init.sh:ro \ - --name db2 \ - --privileged=true \ - ibmcom/db2:11.5.0.0 - -sudo docker logs -f db2 | sed '/(*) Setup has completed./ q' - -echo DB2 started diff --git a/ci/travis/install-mssql-pdo_sqlsrv.sh b/ci/travis/install-mssql-pdo_sqlsrv.sh deleted file mode 100644 index 71e07aee231..00000000000 --- a/ci/travis/install-mssql-pdo_sqlsrv.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Installing extension" - -pecl install pdo_sqlsrv-5.7.0preview diff --git a/ci/travis/install-mssql-sqlsrv.sh b/ci/travis/install-mssql-sqlsrv.sh deleted file mode 100644 index d44841360dc..00000000000 --- a/ci/travis/install-mssql-sqlsrv.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Installing extension" - -pecl install sqlsrv-5.7.0preview diff --git a/ci/travis/install-mssql.sh b/ci/travis/install-mssql.sh deleted file mode 100644 index d17058e3455..00000000000 --- a/ci/travis/install-mssql.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo Setting up Microsoft SQL Server - -sudo docker pull microsoft/mssql-server-linux:2017-latest -sudo docker run \ - -e 'ACCEPT_EULA=Y' \ - -e 'SA_PASSWORD=Doctrine2018' \ - -e "MSSQL_COLLATION=${MSSQL_COLLATION:-Latin1_General_100_CI_AS}" \ - -p 127.0.0.1:1433:1433 \ - --name mssql \ - -d \ - microsoft/mssql-server-linux:2017-latest - -sudo docker exec -i mssql bash <<< 'until echo quit | /opt/mssql-tools/bin/sqlcmd -S 127.0.0.1 -l 1 -U sa -P Doctrine2018 > /dev/null 2>&1 ; do sleep 1; done' - -echo SQL Server started diff --git a/ci/travis/install-postgres-10.sh b/ci/travis/install-postgres-10.sh deleted file mode 100644 index 88041241e6e..00000000000 --- a/ci/travis/install-postgres-10.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Installing Postgres 10" -sudo service postgresql stop -sudo apt-get remove -q 'postgresql-*' -sudo apt-get update -q -sudo apt-get install -q postgresql-10 postgresql-client-10 -sudo cp /etc/postgresql/{9.6,10}/main/pg_hba.conf - -echo "Restarting Postgres 10" -sudo service postgresql restart diff --git a/ci/travis/install-postgres-11.sh b/ci/travis/install-postgres-11.sh deleted file mode 100644 index 2ef1aabc4f0..00000000000 --- a/ci/travis/install-postgres-11.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo "Preparing Postgres 11" - -sudo service postgresql stop || true - -sudo docker run -d --name postgres11 -p 5432:5432 postgres:11.1 -sudo docker exec -i postgres11 bash <<< 'until pg_isready -U postgres > /dev/null 2>&1 ; do sleep 1; done' - -echo "Postgres 11 ready" diff --git a/ci/travis/install-sqlsrv-dependencies.sh b/ci/travis/install-sqlsrv-dependencies.sh deleted file mode 100644 index ff91bfdfaf0..00000000000 --- a/ci/travis/install-sqlsrv-dependencies.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -echo Installing driver dependencies - -curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - -curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql.list -sudo apt-get update -ACCEPT_EULA=Y sudo apt-get install -qy msodbcsql17 unixodbc unixodbc-dev libssl1.0.0 diff --git a/ci/travis/mariadb.docker.travis.xml b/ci/travis/mariadb.docker.travis.xml deleted file mode 100644 index c06caf61efc..00000000000 --- a/ci/travis/mariadb.docker.travis.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - ../../tests - - - - - - ../../src - - - diff --git a/ci/travis/mariadb.mysqli.docker.travis.xml b/ci/travis/mariadb.mysqli.docker.travis.xml deleted file mode 100644 index eb1853aa26d..00000000000 --- a/ci/travis/mariadb.mysqli.docker.travis.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - ../../tests - - - - - - ../../src - - - diff --git a/composer.lock b/composer.lock index 8ebd2bc2ca7..a7a5b1ebefa 100644 --- a/composer.lock +++ b/composer.lock @@ -147,10 +147,6 @@ "cache", "caching" ], - "support": { - "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/v1.7.1" - }, "time": "2017-08-25T07:02:50+00:00" }, { @@ -225,10 +221,6 @@ "eventdispatcher", "eventmanager" ], - "support": { - "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/master" - }, "time": "2018-06-11T11:59:03+00:00" } ], @@ -309,11 +301,6 @@ "non-blocking", "promise" ], - "support": { - "irc": "irc://irc.freenode.org/amphp", - "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/master" - }, "funding": [ { "url": "https://github.com/amphp", @@ -386,11 +373,6 @@ "non-blocking", "stream" ], - "support": { - "irc": "irc://irc.freenode.org/amphp", - "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/master" - }, "time": "2020-06-29T18:35:05+00:00" }, { @@ -452,11 +434,6 @@ "validation", "versioning" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/1.5.1" - }, "time": "2020-01-13T12:06:48+00:00" }, { @@ -501,11 +478,6 @@ "Xdebug", "performance" ], - "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.3" - }, "funding": [ { "url": "https://packagist.com", @@ -586,10 +558,6 @@ "stylecheck", "tests" ], - "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" - }, "time": "2020-06-25T14:57:39+00:00" }, { @@ -683,10 +651,6 @@ "standard", "style" ], - "support": { - "issues": "https://github.com/doctrine/coding-standard/issues", - "source": "https://github.com/doctrine/coding-standard/tree/8.1.x" - }, "time": "2020-07-05T20:35:22+00:00" }, { @@ -802,10 +766,6 @@ } ], "description": "A more advanced JSONRPC implementation", - "support": { - "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/master" - }, "time": "2020-03-11T15:21:41+00:00" }, { @@ -853,10 +813,6 @@ "php", "server" ], - "support": { - "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.4.0" - }, "time": "2019-06-23T21:03:50+00:00" }, { @@ -901,9 +857,6 @@ "stubs", "type" ], - "support": { - "source": "https://github.com/JetBrains/phpstorm-stubs/tree/master" - }, "time": "2019-12-05T16:56:26+00:00" }, { @@ -1008,11 +961,6 @@ } ], "description": "Map nested JSON structures onto PHP classes", - "support": { - "email": "cweiske@cweiske.de", - "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/master" - }, "time": "2020-04-16T18:48:43+00:00" }, { @@ -1118,10 +1066,6 @@ "xml", "xml conversion" ], - "support": { - "issues": "https://github.com/nullivex/lib-array2xml/issues", - "source": "https://github.com/nullivex/lib-array2xml/tree/master" - }, "time": "2019-03-29T20:06:56+00:00" }, { @@ -1282,10 +1226,6 @@ "reflection", "static analysis" ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, "time": "2020-06-27T09:03:43+00:00" }, { @@ -1507,10 +1447,6 @@ "MIT" ], "description": "PHPDoc parser with support for nullable, intersection and generic types", - "support": { - "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/master" - }, "time": "2020-04-13T16:28:46+00:00" }, { @@ -2098,10 +2034,6 @@ } ], "description": "Psalm plugin for PHPUnit", - "support": { - "issues": "https://github.com/psalm/psalm-plugin-phpunit/issues", - "source": "https://github.com/psalm/psalm-plugin-phpunit/tree/0.10.1" - }, "time": "2020-05-24T20:30:10+00:00" }, { @@ -2149,9 +2081,6 @@ "psr", "psr-3" ], - "support": { - "source": "https://github.com/php-fig/log/tree/1.1.3" - }, "time": "2020-03-23T09:12:05+00:00" }, { @@ -3159,10 +3088,6 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", - "support": { - "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/6.3.10" - }, "funding": [ { "url": "https://github.com/kukulich", @@ -3224,11 +3149,6 @@ "phpcs", "standards" ], - "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" - }, "time": "2020-04-17T01:09:41+00:00" }, { @@ -3431,9 +3351,6 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "support": { - "source": "https://github.com/symfony/debug/tree/4.0" - }, "time": "2018-02-28T21:50:02+00:00" }, { @@ -3496,9 +3413,6 @@ "polyfill", "portable" ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.18.0" - }, "funding": [ { "url": "https://symfony.com/sponsor", @@ -3778,10 +3692,6 @@ "check", "validate" ], - "support": { - "issues": "https://github.com/webmozart/assert/issues", - "source": "https://github.com/webmozart/assert/tree/master" - }, "time": "2020-07-08T17:02:28+00:00" }, { @@ -3829,10 +3739,6 @@ } ], "description": "A PHP implementation of Ant's glob.", - "support": { - "issues": "https://github.com/webmozart/glob/issues", - "source": "https://github.com/webmozart/glob/tree/master" - }, "time": "2015-12-29T11:14:33+00:00" }, { @@ -3879,10 +3785,6 @@ } ], "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "support": { - "issues": "https://github.com/webmozart/path-util/issues", - "source": "https://github.com/webmozart/path-util/tree/2.3.0" - }, "time": "2015-12-17T08:42:14+00:00" } ], diff --git a/src/Schema/Comparator.php b/src/Schema/Comparator.php index c1e3fb4eef8..7ddf5238d16 100644 --- a/src/Schema/Comparator.php +++ b/src/Schema/Comparator.php @@ -191,7 +191,7 @@ public function diffSequence(Sequence $sequence1, Sequence $sequence2) } /** - * Returns the difference between the tables $table1 and $table2. + * Returns the difference between the tables $fromTable and $toTable. * * If there are no differences this method returns the boolean false. * @@ -199,18 +199,18 @@ public function diffSequence(Sequence $sequence1, Sequence $sequence2) * * @throws SchemaException */ - public function diffTable(Table $table1, Table $table2) + public function diffTable(Table $fromTable, Table $toTable) { $changes = 0; - $tableDifferences = new TableDiff($table1->getName()); - $tableDifferences->fromTable = $table1; + $tableDifferences = new TableDiff($fromTable->getName()); + $tableDifferences->fromTable = $fromTable; - $table1Columns = $table1->getColumns(); - $table2Columns = $table2->getColumns(); + $fromTableColumns = $fromTable->getColumns(); + $toTableColumns = $toTable->getColumns(); - /* See if all the columns in table 1 exist in table 2 */ - foreach ($table2Columns as $columnName => $column) { - if ($table1->hasColumn($columnName)) { + /* See if all the columns in "from" table exist in "to" table */ + foreach ($toTableColumns as $columnName => $column) { + if ($fromTable->hasColumn($columnName)) { continue; } @@ -218,23 +218,23 @@ public function diffTable(Table $table1, Table $table2) $changes++; } - /* See if there are any removed columns in table 2 */ - foreach ($table1Columns as $columnName => $column) { - // See if column is removed in table 2. - if (! $table2->hasColumn($columnName)) { + /* See if there are any removed columns in "to" table */ + foreach ($fromTableColumns as $columnName => $column) { + // See if column is removed in "to" table. + if (! $toTable->hasColumn($columnName)) { $tableDifferences->removedColumns[$columnName] = $column; $changes++; continue; } - // See if column has changed properties in table 2. - $changedProperties = $this->diffColumn($column, $table2->getColumn($columnName)); + // See if column has changed properties in "to" table. + $changedProperties = $this->diffColumn($column, $toTable->getColumn($columnName)); if (count($changedProperties) === 0) { continue; } - $columnDiff = new ColumnDiff($column->getName(), $table2->getColumn($columnName), $changedProperties); + $columnDiff = new ColumnDiff($column->getName(), $toTable->getColumn($columnName), $changedProperties); $columnDiff->fromColumn = $column; $tableDifferences->changedColumns[$column->getName()] = $columnDiff; @@ -243,12 +243,12 @@ public function diffTable(Table $table1, Table $table2) $this->detectColumnRenamings($tableDifferences); - $table1Indexes = $table1->getIndexes(); - $table2Indexes = $table2->getIndexes(); + $fromTableIndexes = $fromTable->getIndexes(); + $toTableIndexes = $toTable->getIndexes(); - /* See if all the indexes in table 1 exist in table 2 */ - foreach ($table2Indexes as $indexName => $index) { - if (($index->isPrimary() && $table1->hasPrimaryKey()) || $table1->hasIndex($indexName)) { + /* See if all the indexes in "from" table exist in "to" table */ + foreach ($toTableIndexes as $indexName => $index) { + if (($index->isPrimary() && $fromTable->hasPrimaryKey()) || $fromTable->hasIndex($indexName)) { continue; } @@ -256,56 +256,56 @@ public function diffTable(Table $table1, Table $table2) $changes++; } - /* See if there are any removed indexes in table 2 */ - foreach ($table1Indexes as $indexName => $index) { - // See if index is removed in table 2. + /* See if there are any removed indexes in "to" table */ + foreach ($fromTableIndexes as $indexName => $index) { + // See if index is removed in "to" table. if ( - ($index->isPrimary() && ! $table2->hasPrimaryKey()) || - ! $index->isPrimary() && ! $table2->hasIndex($indexName) + ($index->isPrimary() && ! $toTable->hasPrimaryKey()) || + ! $index->isPrimary() && ! $toTable->hasIndex($indexName) ) { $tableDifferences->removedIndexes[$indexName] = $index; $changes++; continue; } - // See if index has changed in table 2. - $table2Index = $index->isPrimary() ? $table2->getPrimaryKey() : $table2->getIndex($indexName); - assert($table2Index instanceof Index); + // See if index has changed in "to" table. + $toTableIndex = $index->isPrimary() ? $toTable->getPrimaryKey() : $toTable->getIndex($indexName); + assert($toTableIndex instanceof Index); - if (! $this->diffIndex($index, $table2Index)) { + if (! $this->diffIndex($index, $toTableIndex)) { continue; } - $tableDifferences->changedIndexes[$indexName] = $table2Index; + $tableDifferences->changedIndexes[$indexName] = $toTableIndex; $changes++; } $this->detectIndexRenamings($tableDifferences); - $fromFkeys = $table1->getForeignKeys(); - $toFkeys = $table2->getForeignKeys(); + $fromForeignKeys = $fromTable->getForeignKeys(); + $toForeignKeys = $toTable->getForeignKeys(); - foreach ($fromFkeys as $key1 => $constraint1) { - foreach ($toFkeys as $key2 => $constraint2) { - if ($this->diffForeignKey($constraint1, $constraint2) === false) { - unset($fromFkeys[$key1], $toFkeys[$key2]); + foreach ($fromForeignKeys as $fromKey => $fromConstraint) { + foreach ($toForeignKeys as $toKey => $toConstraint) { + if ($this->diffForeignKey($fromConstraint, $toConstraint) === false) { + unset($fromForeignKeys[$fromKey], $toForeignKeys[$toKey]); } else { - if (strtolower($constraint1->getName()) === strtolower($constraint2->getName())) { - $tableDifferences->changedForeignKeys[] = $constraint2; + if (strtolower($fromConstraint->getName()) === strtolower($toConstraint->getName())) { + $tableDifferences->changedForeignKeys[] = $toConstraint; $changes++; - unset($fromFkeys[$key1], $toFkeys[$key2]); + unset($fromForeignKeys[$fromKey], $toForeignKeys[$toKey]); } } } } - foreach ($fromFkeys as $constraint1) { - $tableDifferences->removedForeignKeys[] = $constraint1; + foreach ($fromForeignKeys as $fromConstraint) { + $tableDifferences->removedForeignKeys[] = $fromConstraint; $changes++; } - foreach ($toFkeys as $constraint2) { - $tableDifferences->addedForeignKeys[] = $constraint2; + foreach ($toForeignKeys as $toConstraint) { + $tableDifferences->addedForeignKeys[] = $toConstraint; $changes++; }