-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
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
binaryuuid wrongly seen as binary in tests #17420
Comments
Is the schema being generated by your migration different than the fixture schema? |
No
for both actual DB and test setup. Is it possible to see the results? As the DB is resetting after each test right now. |
This branch/PR showcases it in real life example: dereuromark/cakephp-sandbox#66 Also: |
You could dump the generated schema out of the database server. I'm guessing that the column types we're generating aren't being picked up by schema reflection as binaryuuid. |
Looking at the schema your currently generating through migrations I see CREATE TABLE `exposed_users` (`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `name` VARCHAR(100) NOT NULL, `uuid` BINARY_BLOB NOT NULL, `created` DATETIME_TEXT NOT NULL, `modified` DATETIME_TEXT NOT NULL); Which does not qualify as The root cause of this issue is that phinx currently maps If we cannot make this change in phinx because of backwards compatibility, then this is more fuel under the fire for cakephp/migrations#647 so that we can make the change in migrations. I know you're not a fan of having to use migrations for test schema. Would having the abstract format that we use for cakephp exposed as a public interface be a better solution for you? |
Sounds like a bugfix for phinx, since this doesn't seem to be fully working. |
Or we shim it in migrations plugin |
Yeah, so turns out that But cakephp/phinx#2239 doesnt quite fix it either yet |
Description
When opening the browser, all seems well for a uuid table defined in migrations as
and correctly in DB as binary(16)
When running tests however, on find() the resource is written directly into the entity field as such (not as converted strings), making the tests fail.
The reason seems to be that the type of that column is suddenly binary only, in tests.
So the BinaryUuidType::toPhp() is never invoked, of course.
This seems to be a regression coming from 4.x where this worked (and tests were green)
Note: This seems to happen with any type of DB, Mysql/Sqlite...
Refs https://github.com/dereuromark/cakephp-sandbox/actions/runs/6806484697/job/18507784939#step:10:384
The only difference is that in 4.x I used the fixture structure directly, with 5.x I was now forced to move to Migrator run.
CakePHP Version
5.x
PHP Version
8.2
The text was updated successfully, but these errors were encountered: