Skip to content

bool data type is not mapped to boolean for sqlite - #17674

Closed
DeepDiver1975 wants to merge 1 commit into
masterfrom
map-bool-to-boolean-on-sqlite
Closed

DeepDiver1975 wants to merge 1 commit into
masterfrom
map-bool-to-boolean-on-sqlite

Conversation

@DeepDiver1975

Copy link
Copy Markdown
Contributor

fixes #17671

@DeepDiver1975 DeepDiver1975 added this to the 8.2-current milestone Jul 16, 2015
@scrutinizer-notifier

Copy link
Copy Markdown

A new inspection was created.

@rullzer

rullzer commented Jul 16, 2015

Copy link
Copy Markdown
Contributor

How do you want me to test this other than running the unit tests?

@MorrisJobke

Copy link
Copy Markdown
Contributor

@rullzer Install with master on sqlite and add a table with such a column ;) Then upgrade and check if it is now correctly boolean ;)

@nickvergessen

Copy link
Copy Markdown
Contributor

Can we have a test? 🙊 🏃

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

Can we have a test? 🙊 🏃

Well - this happens in case there is a table in the db which was created outside of the scope ownCloud.

Do too sure if we should test something like this.

@PVince81

PVince81 commented Aug 6, 2015

Copy link
Copy Markdown
Contributor

I can't believe we never used bool in core 😮

@PVince81

PVince81 commented Aug 6, 2015

Copy link
Copy Markdown
Contributor

Tested as follows:

  1. Append this in db_structure.xml in core:
    <table>

        <name>*dbprefix*testtable</name>

        <declaration>

        <field>
            <name>keyid</name>
            <type>integer</type>
            <default>0</default>
            <notnull>true</notnull>
            <unsigned>true</unsigned>
            <length>4</length>
            <autoincrement>1</autoincrement>
        </field>

        <field>
            <name>testboolfalse</name>
            <type>boolean</type>
            <default>false</default>
        </field>
        <field>
            <name>testbooltrue</name>
            <type>boolean</type>
            <default>true</default>
        </field>
        <field>
            <name>testboolempty</name>
            <type>boolean</type>
            <default>true</default>
        </field>

        </declaration>

    </table>
  1. Setup OC on this branch
  2. Increase version in version.php
  3. Run the update

Tested with SQLite and MySQL 👍

@MorrisJobke

Copy link
Copy Markdown
Contributor

I can't believe we never used bool in core 😮

Yes. We never used bool we used boolean with works ;)

@MorrisJobke

Copy link
Copy Markdown
Contributor

If I change the test table of @PVince81 to bool the setup doesn't work anymore.

@DeepDiver1975 Can you have a look.

I get following message:

Error while trying to create admin user: Unknown column type "bool" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information. 

@MorrisJobke

Copy link
Copy Markdown
Contributor

@DeepDiver1975 This is still broken. Please fix :)

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

Yeah - one day ....

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

Well, we now use booleans in core. Perhaps it's a good time to brush off the dust on this PR? 😄

@PVince81

Copy link
Copy Markdown
Contributor

@DeepDiver1975 any update ?
(note: we don't use booleans any more now in core)

@DeepDiver1975
DeepDiver1975 force-pushed the map-bool-to-boolean-on-sqlite branch from 5690771 to 0ba937d Compare September 23, 2015 13:13
@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

Okay, guys - you are getting this wrong I guess - the intention of this pr is not to introduce bool as valid type in our xml db structure.

This wil 'only' fix the case that some existing table in the sqlite db is using a bool columns and the upgrade process will not fall apart.

@RobinMcCorkell

Copy link
Copy Markdown
Contributor

@DeepDiver1975 So is bool a valid type for our DB schema at all? Doctrine happily eats it, but we've found these bugs with it...

@DeepDiver1975

Copy link
Copy Markdown
Contributor Author

So is bool a valid type for our DB schema at all?

No idea 🙊

@PVince81

PVince81 commented Oct 7, 2015

Copy link
Copy Markdown
Contributor

(D)efer, (K)ill, (R)evive ?

@DeepDiver1975
DeepDiver1975 deleted the map-bool-to-boolean-on-sqlite branch October 7, 2015 13:22
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[master] Migration issue

7 participants