Skip to content

Conversation

@kesselb
Copy link
Contributor

@kesselb kesselb commented Apr 27, 2019

Close #15256

Type::SMALLINT should be Type::BOOLEAN.

MySQL uses a tinyint(1) to store a boolean value where PostgresSql has a dedicated type boolean for booleans. If we create a column with type smallint and try to save a boolean postgresql 💥

https://github.com/doctrine/dbal/blob/e4978c2299d4d8e4f39da94f4d567e698e9bdbeb/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php#L944
https://github.com/doctrine/dbal/blob/e4978c2299d4d8e4f39da94f4d567e698e9bdbeb/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php#L299

Tested these changes only on mysql (smallint to tinyint there). Tried multiple ways to do it with one migration but doctrine is smart enough to merge dropColumn and addColumn to changeColumn which fails on pqsql because for a integer to boolean conversion we need additional instructions for pqsql which is not supported by doctrine yet (e.g. https://drone.nextcloud.com/nextcloud/server/18043/21/5)

@kesselb kesselb added this to the Nextcloud 17 milestone Apr 27, 2019
@kesselb kesselb force-pushed the bugfix/15256-wrong-column-type branch 2 times, most recently from d80a082 to 0249f95 Compare April 27, 2019 21:25
@dtzWill
Copy link

dtzWill commented Apr 28, 2019

Looks like this is a winner, yes? (drone failure seems to be due to a cancelled build)

kesselb added 6 commits May 2, 2019 21:10
On pqsql true/false is no valid value for an integer column.

Signed-off-by: Daniel Kesselberg <[email protected]>
Signed-off-by: Daniel Kesselberg <[email protected]>
Signed-off-by: Daniel Kesselberg <[email protected]>
@kesselb kesselb force-pushed the bugfix/15256-wrong-column-type branch from 1f72d5e to ef3725e Compare May 2, 2019 19:11
@dtzWill
Copy link

dtzWill commented May 3, 2019

Ping? 😇

@kesselb kesselb mentioned this pull request May 7, 2019
Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works 👍

@MorrisJobke MorrisJobke requested a review from ChristophWurst May 7, 2019 21:39
@MorrisJobke MorrisJobke merged commit 4cb66fd into master May 7, 2019
@MorrisJobke MorrisJobke deleted the bugfix/15256-wrong-column-type branch May 7, 2019 21:52
@MorrisJobke
Copy link
Member

/backport to stable16

@backportbot-nextcloud
Copy link

backport to stable16 in #15434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"access" column of "collres_accesscache" is bool in some places and integer in others, breaks w/psql

5 participants