question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recently 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:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thetutlagecommented, Jun 18, 2018

The warning is correct. All knex is asking is to use hasTable in combination with createTable.

So simply remove createTableIfExists and use what knex is suggesting.

0reactions
iamraphsoncommented, Jun 18, 2018

thanks @thetutlage

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found