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.

Migrations and model definitions complains when using TEXT('long') on sqlite

See original GitHub issue

I’m aware of:

https://github.com/sequelize/sequelize/pull/3836 https://github.com/sequelize/sequelize/pull/3839

but still don’t like https://github.com/sequelize/sequelize/pull/3839, IMHO is completely unnecesary, and at least there has to be a way to disable that behavior.

What you are doing?

Using SQLite adapter for development and MariaDB for staging/production, and defining an unlimited TEXT attribute:

description: {
      type   : Sequelize.TEXT('long')
    }

What do you expect to happen?

In SQLite, it should treat the attribute as a TEXT, and in MariaDB as a LONGTEXT, without complaining and triggering the error, since I think an ORM should do like jQuery did in the past, homogenize the same code and make easier changing the adapter without changing the code (among other thing, I know).

The funny thing is that it correctly translates the type according with the adapter, since was added in https://github.com/sequelize/sequelize/pull/3836, but it also triggers an annoying error/warning that IMHO it should not be doing.

What is actually happening?

It is triggering the following error/warning, preventing my app to start correctly:

error: >> WARNING: SQLite does not support TEXT with options. Plain `TEXT` will be used instead. 
>> Check: https://www.sqlite.org/datatype3.html
 module=core/db, stack=>> WARNING: SQLite does not support TEXT with options. Plain `TEXT` will be used instead. 
>> Check: https://www.sqlite.org/datatype3.html

Dialect: mysql / sqlite Sequelize version: 3.21.0

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
j-mcommented, Jul 1, 2020

Would be nice to be able to silence this warning for dev and test environments. I use SQLite to run tests as it’s much faster and less memory intensive than other dialects. For obvious security reasons I use MySQL or PG for production environments.

1reaction
ephyscommented, Dec 16, 2022

We’re working on making all console output generated by Sequelize go through the log option that the Sequelize constructor accepts. (https://github.com/sequelize/sequelize/blob/main/src/dialects/abstract/index.ts#L420-L428)

Once that is done you’ll be able to mute any warning you want.

I must warn that perfect feature parity between dialects is not one of our goals and using a different dialects in prod VS in test can lead to bugs appearing in production. You’re of course still free to handle your tests any way you want.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Datatypes In SQLite
A column with TEXT affinity stores all data using storage classes NULL, TEXT or BLOB. If numerical data is inserted into a column...
Read more >
Migrations - Ruby on Rails Guides
Migrations are a convenient way for you to alter your database in a structured and organized manner. You could edit fragments of SQL...
Read more >
Changing a column type to longer strings in rails
You should use text with Rails if you want a string with no length limit. A migration like this: def up change_column :your_table, ......
Read more >
The database abstraction layer - Web2py
The Windows binary distribution works out of the box with SQLite, MSSQL, ... For example, a typical model-less application may leave the definitions...
Read more >
Release Notes - Flyway by Redgate • Database Migrations ...
Remove JNA dependency as no longer needed by MariaDB; Increase MariaDB ... Issue 2221 Flyway 5.2.2 incorrectly complains about required SQLite upgrade ...
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