We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In CakePHP 5.1.4 with Migrations 4.5.0 on SQLite I get a TypeError running migrations in my test suite.
public function up(): void { $this->table('user_rate_limits') ->addColumn('id', Column::INTEGER, [ 'autoIncrement' => true, 'default' => null, 'limit' => null, 'null' => false, 'signed' => false, ]) ->addColumn('ip_address', Column::STRING, [ 'null' => true, 'default' => null, 'limit' => 64, ]) ->addColumn('user_id', Column::UUID, [ 'null' => true, 'default' => null, ]) ->addColumn('limit_type', Column::ENUM, [ 'null' => false, 'values' => ['pre_day', 'per_minute', 'auth'], ]) ->addColumn('subscription', Column::STRING, [ 'null' => true, 'default' => null, 'limit' => 64, ]) ->addColumn('created', Column::DATETIME, [ 'null' => false, ]) ->addColumn('modified', Column::DATETIME, [ 'null' => false, ]) ->addPrimaryKey('id') ->save(); }
I had to change the ->addPrimaryKey('id') to ->addPrimaryKey(['id']) but the method signature says string is allowed.
->addPrimaryKey('id')
->addPrimaryKey(['id'])
Success
Xdebug: [Step Debug] Could not connect to debugging client. Tried: 172.17.0.1:9003 (fallback through xdebug.client_host/xdebug.client_port). PHPUnit 10.5.40 by Sebastian Bergmann and contributors. Error in bootstrap script: TypeError: array_search(): Argument #2 ($haystack) must be of type array, string given #0 /srv/app/vendor/cakephp/migrations/src/Db/Adapter/SqliteAdapter.php(385): array_search('id', 'id', true) #1 /srv/app/vendor/cakephp/migrations/src/Db/Adapter/AdapterWrapper.php(317): Migrations\Db\Adapter\SqliteAdapter->createTable(Object(Migrations\Db\Table\Table), Array, Array) #2 /srv/app/vendor/cakephp/migrations/src/Db/Adapter/TimedOutputAdapter.php(112): Migrations\Db\Adapter\AdapterWrapper->createTable(Object(Migrations\Db\Table\Table), Array, Array) #3 /srv/app/vendor/cakephp/migrations/src/Db/Adapter/PhinxAdapter.php(635): Migrations\Db\Adapter\TimedOutputAdapter->createTable(Object(Migrations\Db\Table\Table), Array, Array) #4 /srv/app/vendor/robmorgan/phinx/src/Phinx/Db/Plan/Plan.php(147): Migrations\Db\Adapter\PhinxAdapter->createTable(Object(Phinx\Db\Table\Table), Array, Array) #5 /srv/app/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(725): Phinx\Db\Plan\Plan->execute(Object(Migrations\Db\Adapter\PhinxAdapter)) #6 /srv/app/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(621): Phinx\Db\Table->executeActions(false) #7 /srv/app/vendor/cakephp/migrations/src/Table.php(142): Phinx\Db\Table->create() #8 /srv/app/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(694): Migrations\Table->create() #9 /srv/app/config/Migrations/20250111024445_UserRateLimits.php(53): Phinx\Db\Table->save() #10 /srv/app/vendor/cakephp/migrations/src/Shim/MigrationAdapter.php(134): UserRateLimits->up() #11 /srv/app/vendor/cakephp/migrations/src/Migration/Environment.php(99): Migrations\Shim\MigrationAdapter->applyDirection('up') #12 /srv/app/vendor/cakephp/migrations/src/Migration/Manager.php(471): Migrations\Migration\Environment->executeMigration(Object(Migrations\Shim\MigrationAdapter), 'up', false) #13 /srv/app/vendor/cakephp/migrations/src/Migration/Manager.php(443): Migrations\Migration\Manager->executeMigration(Object(Migrations\Shim\MigrationAdapter), 'up', false) #14 /srv/app/vendor/cakephp/migrations/src/Migration/BuiltinBackend.php(96): Migrations\Migration\Manager->migrate(20250111024445) #15 /srv/app/vendor/cakephp/migrations/src/Migrations.php(186): Migrations\Migration\BuiltinBackend->migrate(Array) #16 /srv/app/vendor/cakephp/migrations/src/TestSuite/Migrator.php(117): Migrations\Migrations->migrate(Array) #17 /srv/app/tests/bootstrap.php(43): Migrations\TestSuite\Migrator->runMany(Array) #18 /srv/app/vendor/phpunit/phpunit/src/TextUI/Application.php(343): include_once('/srv/app/tests/...') #19 /srv/app/vendor/phpunit/phpunit/src/TextUI/Application.php(108): PHPUnit\TextUI\Application->loadBootstrapScript('/srv/app/tests/...') #20 /srv/app/vendor/phpunit/phpunit/phpunit(104): PHPUnit\TextUI\Application->run(Array) #21 /srv/app/vendor/bin/phpunit(122): include('/srv/app/vendor...') #22 {main}
The text was updated successfully, but these errors were encountered:
Add missing array cast in SqliteAdapter
ae1ae36
Add an array cast to SqliteAdapter to fix compatibility issue with phinx/table. Fixes #804
markstory
Successfully merging a pull request may close this issue.
In CakePHP 5.1.4 with Migrations 4.5.0 on SQLite I get a TypeError running migrations in my test suite.
Steps to reproduce
I had to change the
->addPrimaryKey('id')
to->addPrimaryKey(['id'])
but the method signature says string is allowed.Expected Result
Success
Actual Result
The text was updated successfully, but these errors were encountered: