Comments (9)
@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.
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.
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.
@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.
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.
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.
As an aside, your latest change breaks the tests, since the sql is expected to contain the "engine = " for the mysql statements.
from knex.
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.
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)
- Wrong TypeScript type when using .count('*')
- pglite support
- esm migrations does not work on Node 22
- Straightforward way of getting the PID of a query, ahead-of-time.
- can't extend existing method
- Error without actual reason in CLI due to TypeScript error
- Unknown pending operation error HOT 1
- Mysql forShare query compiler error
- `timestamps` method signature in schema is misleading
- knexfile.ts broken in esm
- Compile sql during webpack build time
- Unnamed error when JSON constraint prevents an update/insert HOT 2
- [Typescript] Can't return something else than knex in the extend function HOT 1
- Use custom MySQL2 connection pool into Knex - getting stucked
- Knex saving into wrong database, no errors, other tables work fine
- MongoDB Realm Web - features request
- increment/decrement lacks precision for large integers
- Knex knex.fn.now() function triggers syntax error in MSSQL
- Add serverless-postgres to client
- Hey Team, we want to authenticate our Node.js to MySQL using Kerberos. Does knex have built in support for that? Do you have any documentation for that?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knex.