GithubHelp home page GithubHelp logo

Comments (7)

liveforeverx avatar liveforeverx commented on August 17, 2024

Yes, it is because MySQL doesn't have boolean type. And, INT tiny represents it, but there is no way to get from MySQL tyne(1) or tiny(10) it is (checking).

from mariaex.

liveforeverx avatar liveforeverx commented on August 17, 2024

If you will try to save to tiny INT the value 0 or 1, than it is impossible by reading to get right representation, if it is boolean(true, false) or int(0, 1). Is it possible to avoid tiny INTs for integers in your setup?

from mariaex.

nathanjohnson320 avatar nathanjohnson320 commented on August 17, 2024

No I'm running a model generation script on a legacy database where the TINY ints are already setup. Is there no way to check the NUMERIC_PRECISION column in information schema to grab the size and set it as an integer/boolean based on that?

from mariaex.

nathanjohnson320 avatar nathanjohnson320 commented on August 17, 2024

Actually I guess you can't because it's always 3 for tinyints.

from mariaex.

liveforeverx avatar liveforeverx commented on August 17, 2024

To: @laurocaetano @josevalim
May be it make sense to decode tiny int always as int and cast 0, 1 to boolean on ecto side, where model types are available?

@nathanjohnson320 at least, on binary protocol it doesn't send any information about precision.

from mariaex.

josevalim avatar josevalim commented on August 17, 2024

@liveforeverx yes, we could do that. Once you change the behaviour in mariaex and release new version, please open up an issue in Ecto so we can fix it. Also, please release it as 0.3. :)

from mariaex.

liveforeverx avatar liveforeverx commented on August 17, 2024

@josevalim , off course, it is backwards incompatible change.

from mariaex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.