set `TINYINT` and `UNSIGNED INT` not working
luckydrq opened this issue · comments
Deng Ruoqi commented
I'm using egg-orm when encounting this problem and i think it is related with leoric.
Example:
import { Application } from 'egg';
export default (app: Application) => {
const { STRING, INTEGER, DATE } = app.model.DataTypes;
return app.model.define('User', {
name: STRING,
tinyInt: INTEGER('tiny'),
unsignedInt: INTEGER('').UNSIGNED,
deletedAt: DATE,
}, {
tableName: 'users',
});
}
Table in database:
Chen Yangjian commented
try this:
const { STRING, INTEGER, DATE, TINYINT } = app.model.DataTypes;
app.model.define('User', {
name: STRING,
tinyInt: TINYINT,
unsignedInt: INTEGER.UNSIGNED,
deletedAt: DATE,
}
Deng Ruoqi commented
try this:
const { STRING, INTEGER, DATE, TINYINT } = app.model.DataTypes; app.model.define('User', { name: STRING, tinyInt: TINYINT, unsignedInt: INTEGER.UNSIGNED, deletedAt: DATE, }
It seems that TINYINT
not included in DataTypes. I will look into that later.
Chen Yangjian commented
yikes! TINYINT
indeed is not supported yet. I'll look into it.
btw, if the intention is use TINYINT(1)
to represent boolean in MySQL, you can use BOOLEAN directly.
Deng Ruoqi commented
Got