fixed issue when alter tables are performing

This commit is contained in:
Umed Khudoiberdiev 2016-05-27 23:55:05 +05:00
parent 83a3856121
commit 5b1a4e0e14
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,4 @@
import "reflect-metadata";
import {CreateConnectionOptions, createConnection} from "../../src/index";
import {Post} from "./entity/Post";
import {PostDetails} from "./entity/PostDetails";
@ -15,7 +16,10 @@ const options: CreateConnectionOptions = {
username: "root",
password: "admin",
database: "test",
autoSchemaCreate: true
autoSchemaCreate: true,
logging: {
logQueries: true
}
},
entities: [Post, PostDetails, PostCategory, PostMetadata, PostImage, PostInformation, PostAuthor]
};

View File

@ -27,7 +27,7 @@ export class MysqlSchemaBuilder extends SchemaBuilder {
const isNullable = column.isNullable === true ? "YES" : "NO";
const hasDbColumnAutoIncrement = dbData.EXTRA.indexOf("auto_increment") !== -1;
const hasDbColumnPrimaryIndex = dbData.COLUMN_KEY.indexOf("PRI") !== -1;
return dbData.COLUMN_TYPE !== newType ||
return dbData.COLUMN_TYPE.toLowerCase() !== newType.toLowerCase() ||
dbData.COLUMN_COMMENT !== column.comment ||
dbData.IS_NULLABLE !== isNullable ||
hasDbColumnAutoIncrement !== column.isGenerated ||
@ -185,7 +185,7 @@ export class MysqlSchemaBuilder extends SchemaBuilder {
case "text":
return "text";
case "boolean":
return "boolean";
return "tinyint(1)";
case "integer":
case "int":
return "INT(" + (column.length ? column.length : 11) + ")";