![]() A few weeks ago my team was deep into sequelize's internals and we couldn't answer this properly.Īs I said, we solved with a simple conditional, but this particular github issue err on the practical side. It's not a good design to use INTS when TINY/SMALL work, so how do you allow Sequelize models to express this but still work on other databases? Just some questions I had while using the ORM. But should these things be handled transparently, automatically converted, best guessing? Should Sequelize itself deny invalid model attributes on its sync, before it hits the database? The same can be said about Mysql's INT sub-types, such as MEDIUMINT. I understand Sequelize is an ORM, not a database abstraction library. The only case where storing non-meaningful information makes sense is the special case that you want to have a synthetic primary key. sqlite sqljs react-native expo TypeORM version: latest next 0.x.x (or put your version here) When using PrimaryGeneratedColumn, TypeORM isnt setting the column as AUTOINCREMENT, meaning that if I try to insert values into the table outside of TypeORM, I get duplicate key query errors. And the later is documented, but I don't think it's simple a matter of documenting about sqlite UNSIGNED, because of the philosophical issue. 12 Why would you want to have an autoincrement column that is not the primary key If you want a column to be an autoincrement, by definition, you are not storing meaningful data in that column. You can't UNSIGNED a sqlite column, and you also can not ARRAY a non-Postgres column. The practical is that Sequelize allows a certain combination of modeling that does not work, it generates invalid sql statements. How do I create an AUTOINCREMENT field What datatypes does SQLite support SQLite lets me insert a string into a database column of type integer Why doesnt SQLite allow me to use 0 and 0. But I think there are two issues here, one practical and one philosophical. ![]() I am doing it because our code runs both on Mysql and sqlite, so yeah, I am handling in user code.
0 Comments
Leave a Reply. |