Giter Site home page Giter Site logo

Comments (9)

tgriesser avatar tgriesser commented on July 30, 2024

@jblebrun - thanks for the heads up... I just pushed some changes to be able to add the engine on createTable... let me know if this looks good.

from knex.

jblebrun avatar jblebrun commented on July 30, 2024

This does the trick, although it does break the abstraction a bit. Since only MySQL bindings support the engine function for now, it's not a huge deal, but it might be worth thinking through how to cleanly separate implementation-specific details further down the road.

from knex.

tgriesser avatar tgriesser commented on July 30, 2024

Well, it's a no-op if used when it's not a MySQL connection, since it's only used in the compileCreateTable for the MySQL builder... Do you think that'd be alright?

from knex.

tgriesser avatar tgriesser commented on July 30, 2024

@jblebrun - The other I was thinking is maybe if the engine type could be set in the config settings in Knex.Initialize? Then it wouldn't be per-table though...

from knex.

jblebrun avatar jblebrun commented on July 30, 2024

I think doing it in the Initialize step would be better. Otherwise implementation details start to leak into what is supposed to be an implementation-independent means of specifying a schema.

from knex.

jblebrun avatar jblebrun commented on July 30, 2024

For example, what if a database is later added that also supports engines, but different kinds? You couldn't simply change the initializer and expect things to work - the new database might break when it encounters the unexpected engine name that was intended for MySQL.

That said, it's pretty hard to write a schema that is truly implementation independent, if you expect to use all of the features of the database. However, keeping a separation between implementation-specific details and common schema detail makes it easier to migrate from one platform to another - it's easy to detect which parts need to be changed and which don't.

from knex.

jblebrun avatar jblebrun commented on July 30, 2024

As an aside, your latest change breaks the tests, since the sql is expected to contain the "engine = " for the mysql statements.

from knex.

tgriesser avatar tgriesser commented on July 30, 2024

The engine should be set in the tests in the latest...

I agree with the point that you might not be able to simply change the Initializer, though I feel like ultimately the engine should be set on a per-table basis... Also, InnoDB is the default engine with MySQL so there shouldn't normally be a need specify this anyway. I think I'm going to keep it per-table for now and re-visit if there's any conflict down the line.

from knex.

jblebrun avatar jblebrun commented on July 30, 2024

I see, the problem was that the key name in the config file for charset encoding changed from "encoding" to "charset". Since I'm using a different config file, I didn't get this change.

from knex.

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.