mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
fixed issue when alter tables are performing
This commit is contained in:
parent
83a3856121
commit
5b1a4e0e14
@ -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]
|
||||
};
|
||||
|
||||
@ -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) + ")";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user