-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #714 from cakephp/no-phinx
Merge in 'builtin' backend to 4.x
- Loading branch information
Showing
162 changed files
with
39,186 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ jobs: | |
if: matrix.db-type == 'mysql' | ||
run: | | ||
sudo service mysql start | ||
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp_test DEFAULT COLLATE=utf8mb4_general_ci;' | ||
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp_test CHARACTER SET = utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci;' | ||
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp_comparisons;' | ||
mysql -h 127.0.0.1 -u root -proot -e 'CREATE DATABASE cakephp_snapshot;' | ||
|
@@ -119,6 +119,76 @@ jobs: | |
if: success() && matrix.php-version == '8.1' && matrix.db-type == 'mysql' | ||
uses: codecov/codecov-action@v4 | ||
|
||
testsuite-windows: | ||
runs-on: windows-2022 | ||
name: Windows - PHP 8.1 & SQL Server | ||
|
||
env: | ||
EXTENSIONS: mbstring, intl, pdo_sqlsrv | ||
PHP_VERSION: '8.1' | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get date part for cache key | ||
id: key-date | ||
run: echo "::set-output name=date::$(date +'%Y-%m')" | ||
|
||
- name: Setup PHP extensions cache | ||
id: php-ext-cache | ||
uses: shivammathur/cache-extensions@v1 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
extensions: ${{ env.EXTENSIONS }} | ||
key: ${{ steps.key-date.outputs.date }} | ||
|
||
- name: Cache PHP extensions | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.php-ext-cache.outputs.dir }} | ||
key: ${{ runner.os }}-php-ext-${{ steps.php-ext-cache.outputs.key }} | ||
restore-keys: ${{ runner.os }}-php-ext-${{ steps.php-ext-cache.outputs.key }} | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ env.PHP_VERSION }} | ||
extensions: ${{ env.EXTENSIONS }} | ||
ini-values: apc.enable_cli=1, extension=php_fileinfo.dll, zend.assertions=1, error_reporting=-1, display_errors=On | ||
coverage: pcov | ||
|
||
- name: Setup SQLServer | ||
run: | | ||
# MSSQLLocalDB is the default SQL LocalDB instance | ||
SqlLocalDB start MSSQLLocalDB | ||
SqlLocalDB info MSSQLLocalDB | ||
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "create database cakephp_test;" | ||
sqlcmd -S "(localdb)\MSSQLLocalDB" -Q "create database cakephp_snapshot;" | ||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} | ||
|
||
- name: Composer install | ||
run: composer update | ||
|
||
- name: Run PHPUnit | ||
env: | ||
DB_URL: 'sqlserver://(localdb)\MSSQLLocalDB/cakephp_test' | ||
DB_URL_SNAPSHOT: 'sqlserver://(localdb)\MSSQLLocalDB/cakephp_snapshot' | ||
CODECOVERAGE: 1 | ||
run: | | ||
vendor/bin/phpunit --coverage-clover=coverage.xml | ||
- name: Submit code coverage | ||
uses: codecov/codecov-action@v3 | ||
|
||
cs-stan: | ||
uses: cakephp/.github/.github/workflows/[email protected] | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
:caption: CakePHP Migrations | ||
|
||
/index | ||
/upgrading-to-builtin-backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Upgrading to the builtin backend | ||
################################ | ||
|
||
As of migrations XXX there is a new migrations backend that uses CakePHP's | ||
database abstractions and ORM. Longer term this will allow for phinx to be | ||
removed as a dependency. This greatly reduces the dependency footprint of | ||
migrations. | ||
|
||
What is the same? | ||
================= | ||
|
||
Your migrations shouldn't have to change much to adapt to the new backend. | ||
The migrations backend implements all of the phinx interfaces and can run | ||
migrations based on phinx classes. If your migrations don't work in a way that | ||
could be addressed by the changes outlined below, please open an issue, as we'd | ||
like to maintain as much compatibility as we can. | ||
|
||
What is different? | ||
================== | ||
|
||
If your migrations are using the ``AdapterInterface`` to fetch rows or update | ||
rows you will need to update your code. If you use ``Adapter::query()`` to | ||
execute queries, the return of this method is now | ||
``Cake\Database\StatementInterface`` instead. This impacts ``fetchAll()``, | ||
and ``fetch()``:: | ||
|
||
// This | ||
$stmt = $this->getAdapter()->query('SELECT * FROM articles'); | ||
$rows = $stmt->fetchAll(); | ||
|
||
// Now needs to be | ||
$stmt = $this->getAdapter()->query('SELECT * FROM articles'); | ||
$rows = $stmt->fetchAll('assoc'); | ||
|
||
Similar changes are for fetching a single row:: | ||
|
||
// This | ||
$stmt = $this->getAdapter()->query('SELECT * FROM articles'); | ||
$rows = $stmt->fetch(); | ||
|
||
// Now needs to be | ||
$stmt = $this->getAdapter()->query('SELECT * FROM articles'); | ||
$rows = $stmt->fetch('assoc'); | ||
|
||
Enabling the new backend | ||
======================== | ||
|
||
The new backend can be enabled through application configuration. Add the | ||
following to your ``config/app.php``:: | ||
|
||
return [ | ||
// Other configuration. | ||
'Migrations' => ['backend' => 'builtin'], | ||
]; | ||
|
||
If your migrations have problems running with the builtin backend, removing this | ||
configuration option will revert to using phinx. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.