diff --git a/src/drivers/MysqlDriver.ts b/src/drivers/MysqlDriver.ts index 23c0c0f..a0352f0 100644 --- a/src/drivers/MysqlDriver.ts +++ b/src/drivers/MysqlDriver.ts @@ -72,6 +72,9 @@ export class MysqlDriver extends AbstractDriver { resp.COLUMN_DEFAULT ); colInfo.options.type = resp.DATA_TYPE as any; + colInfo.options.unsigned = resp.COLUMN_TYPE.endsWith( + " unsigned" + ); switch (resp.DATA_TYPE) { case "int": colInfo.tsType = "number"; diff --git a/src/entity.mst b/src/entity.mst index 719c657..499b080 100644 --- a/src/entity.mst +++ b/src/entity.mst @@ -15,7 +15,8 @@ import {BaseEntity,Column,Entity,Index,JoinColumn,JoinTable,ManyToMany,ManyToOne primary:{{primary}},{{/primary}}{{/generated}}{{#unique}} unique: true,{{/unique}}{{#length}} length:{{.}},{{/length}}{{#width}} - width:{{.}},{{/width}}{{#default}} + width:{{.}},{{/width}}{{#unsigned}} + unsigned: true,{{/unsigned}}{{#default}} default: {{.}},{{/default}}{{#precision}} precision:{{.}},{{/precision}}{{#scale}} scale:{{.}},{{/scale}}{{#enum}} diff --git a/test/integration/entityTypes/mysql/entity/Post.ts b/test/integration/entityTypes/mysql/entity/Post.ts index 60c5282..0c49fb5 100644 --- a/test/integration/entityTypes/mysql/entity/Post.ts +++ b/test/integration/entityTypes/mysql/entity/Post.ts @@ -15,10 +15,13 @@ export class Post { @Column("int") int: number; + @Column("int", { unsigned: true }) + uint: number; + @Column("tinyint") tinyint: number; - @Column("tinyint",{width:1}) + @Column("tinyint", { width: 1 }) boolean: boolean; @Column("smallint")