Coder Social home page Coder Social logo

Comments (6)

tanner0101 avatar tanner0101 commented on June 2, 2024

@bottlehall you can use .sql(raw: "TEXT") if you want specifically the TEXT datatype. AFAIK VARCHAR(255) is still the recommended column type for "normal length" strings. In other words, a good fit for Fluent's .string data type. However, I agree that .sql(.text) should probably translate to using TEXT in MySQL. It's a bit weird that would also use VARCHAR(255).

from mysql-kit.

tanner0101 avatar tanner0101 commented on June 2, 2024

Let me know if that seems right and if you'd like to submit a PR. Otherwise I will, thanks!

from mysql-kit.

bottlehall avatar bottlehall commented on June 2, 2024

@tanner0101, thanks. I will do a PR in the next few days.

from mysql-kit.

bottlehall avatar bottlehall commented on June 2, 2024

Tried doing a PR but it has errors during testing. Haven't checked them all exhaustively but this is indicative:

"MySQL error: Server error: BLOB, TEXT, GEOMETRY or JSON column 'name' can't have a default value"

from mysql-kit.

bottlehall avatar bottlehall commented on June 2, 2024

Error above arises because SQLBenchmarker+Planets.swift creates a test table with a 'name' field that is type .text with a default value.

from mysql-kit.

tanner0101 avatar tanner0101 commented on June 2, 2024

Hmm... that's unfortunate. The easiest fix would be to check if db.dialect.name == "mysql" and use VARCHAR(255) explicitly. We can merge that through first then tests should pass for #291.

Going forward, maybe some method for getting a "best fit" type for a Swift type (like bestDataType<T>(for: T.Type) -> SQLExpression) would be useful to add to SQLDialect. Then we could change that line in the benchmark test to:

.column("name", type: .best(for: String.self), .default("Unamed Planet"))

from mysql-kit.

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.