knex.js warning
See original GitHub issueRecently I’ve been running migrations and received this warning.
package.json is:
"@adonisjs/lucid": "^5.0.2",
Knex:warning - Use async .hasTable to check if table exists and then use plain .createTable. Since .createTableIfNotExists actually just generates plain "CREATE TABLE IF NOT EXIST..." query it will not work correctly if there are any alter table queries generated for columns afterwards. To not break old migrations this function is left untouched for now, but it should not be used when writing new code and it is removed from documentation.
Just FYI
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Knex Query Builder
Optional second argument for passing options:* only: if true , the ONLY keyword is used before the tableName to discard inheriting tables' data....
Read more >Knex transaction Promises warnings - Stack Overflow
When using a transaction block, you can return a Promise and knex will automatically commit/rollback if the Promise is resolved/rejected.
Read more >Stop using Knex.js. Using SQL query builder is an…
“Knex.js is safe by default” ... I assume that “safe by default” means that one needs to go out of its way to...
Read more >knex | Yarn - Package Manager
A batteries-included, multi-dialect (PostgreSQL, MySQL, CockroachDB, MSSQL, SQLite3, Oracle (including Oracle Wallet Authentication)) query builder for Node.js, ...
Read more >Persistent storage SQL queries with Knex - Luca De Feo
Read more on the schema builder at http://knexjs.org/#Schema. WARNING! Asynchronous calls ahead §. This does nothing ( x is only a promise). var ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The warning is correct. All knex is asking is to use
hasTable
in combination withcreateTable
.So simply remove
createTableIfExists
and use what knex is suggesting.thanks @thetutlage