Skip to content

Make access column a real boolean - #15259

Merged
MorrisJobke merged 6 commits into
masterfrom
bugfix/15256-wrong-column-type
May 7, 2019
Merged

Make access column a real boolean#15259
MorrisJobke merged 6 commits into
masterfrom
bugfix/15256-wrong-column-type

Conversation

@kesselb

@kesselbkesselb commented Apr 27, 2019

Copy link
Copy Markdown
Contributor

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)

@kesselbkesselb added this to the Nextcloud 17 milestone Apr 27, 2019
@kesselb
kesselbforce-pushed the bugfix/15256-wrong-column-type branch 2 times, most recently from d80a082 to 0249f95CompareApril 27, 2019 21:25
@dtzWill

Copy link
Copy Markdown

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

Comment threadcore/Migrations/Version16000Date20190428150708.php Outdated
Comment threadcore/Migrations/Version16000Date20190428150708.php Outdated
Comment threadcore/Migrations/Version16000Date20190427105638.php Outdated
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 <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
kesselbforce-pushed the bugfix/15256-wrong-column-type branch from 1f72d5e to ef3725eCompareMay 2, 2019 19:11
@dtzWill

Copy link
Copy Markdown

Ping? 😇

@kesselbkesselb mentioned this pull request May 7, 2019

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

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 merged commit 4cb66fd into masterMay 7, 2019
@MorrisJobke
MorrisJobke deleted the bugfix/15256-wrong-column-type branch May 7, 2019 21:52
@MorrisJobke

Copy link
Copy Markdown
Member

/backport to stable16

@backportbot-nextcloud

Copy link
Copy Markdown

backport to stable16 in #15434

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

Labels

3. to reviewWaiting for reviewsbug

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

4 participants

@kesselb@dtzWill@MorrisJobke@nickvergessen