adonisjs / lucid

AdonisJS SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
https://lucid.adonisjs.com/
MIT License
1.07k stars 191 forks source link

knex.js warning #304

Closed openstepmedia closed 6 years ago

openstepmedia commented 6 years ago

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

iamraphson commented 6 years ago

@thetutlage @RomainLanz Any update about this warning?

RomainLanz commented 6 years ago

When do you have this warning (which driver and what have you done)?

iamraphson commented 6 years ago

recently when I run a migration

RomainLanz commented 6 years ago

Does this is still an issue? @iamraphson @openstepmedia

iamraphson commented 6 years ago

image

@RomainLanz yes, I have updated all my NPM packages.

thetutlage commented 6 years ago

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.

iamraphson commented 6 years ago

thanks @thetutlage

chelizichen commented 6 months ago

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.

thanks