Added support for UNSIGNED columns in MySQL. (#179)

Added support for UNSIGNED columns in MySQL.
This commit is contained in:
Kononnable 2019-07-19 11:37:24 +02:00 committed by GitHub
commit ce8d37c075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -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";

View File

@ -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}}

View File

@ -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")