fixed generated columns order

This commit is contained in:
Kononnable 2019-03-15 12:33:45 +01:00
parent 45dd1b0021
commit 87690d0547
5 changed files with 10 additions and 9 deletions

View File

@ -4,6 +4,7 @@
* fixed generation of ManyToMany relations on junction tables with custom names(#151)
* fixed problems with mysql 8
* fixed shadowed variables tslint errors( #141)
* fixed generated columns order
## 0.3.1
* Fixed npx ussage(#146)

View File

@ -102,7 +102,6 @@ function removeColumnDefaultProperties(
column.options.length === defVal.length
) {
column.options.length = undefined;
// console.log(`Default length for ${column.options.type}`)
}
if (
column.options.precision &&
@ -110,7 +109,6 @@ function removeColumnDefaultProperties(
column.options.precision === defVal.precision
) {
column.options.precision = undefined;
// console.log(`Default precision for ${column.options.type}`)
}
if (
column.options.scale &&
@ -118,7 +116,6 @@ function removeColumnDefaultProperties(
column.options.scale === defVal.scale
) {
column.options.scale = undefined;
// console.log(`Default scale for ${column.options.type}`)
}
if (
column.options.width &&
@ -126,7 +123,6 @@ function removeColumnDefaultProperties(
column.options.width === defVal.width
) {
column.options.width = undefined;
// console.log(`Default width for ${column.options.type}`)
}
}
});

View File

@ -61,9 +61,11 @@ WHERE TABLE_TYPE='BASE TABLE' and TABLE_SCHEMA in (${schema}) AND TABLE_CATALOG
and tc.TABLE_NAME = c.TABLE_NAME
and cu.COLUMN_NAME = c.COLUMN_NAME
and tc.TABLE_SCHEMA=c.TABLE_SCHEMA) IsUnique
FROM INFORMATION_SCHEMA.COLUMNS c where TABLE_SCHEMA in (${schema}) AND TABLE_CATALOG in (${this.escapeCommaSeparatedList(
FROM INFORMATION_SCHEMA.COLUMNS c
where TABLE_SCHEMA in (${schema}) AND TABLE_CATALOG in (${this.escapeCommaSeparatedList(
dbNames
)})`)).recordset;
)})
order by ordinal_position`)).recordset;
entities.forEach(ent => {
response
.filter(filterVal => {

View File

@ -53,7 +53,8 @@ export class MysqlDriver extends AbstractDriver {
CASE WHEN EXTRA like '%auto_increment%' THEN 1 ELSE 0 END IsIdentity, COLUMN_TYPE, COLUMN_KEY
FROM INFORMATION_SCHEMA.COLUMNS where TABLE_SCHEMA IN (${this.escapeCommaSeparatedList(
dbNames
)})`);
)})
order by ordinal_position`);
entities.forEach(ent => {
response
.filter(filterVal => filterVal.TABLE_NAME === ent.tsEntityName)

View File

@ -58,8 +58,9 @@ export class PostgresDriver extends AbstractDriver {
and tc.TABLE_NAME = c.TABLE_NAME
and cu.COLUMN_NAME = c.COLUMN_NAME
and tc.TABLE_SCHEMA=c.TABLE_SCHEMA) IsUnique
FROM INFORMATION_SCHEMA.COLUMNS c where table_schema in (${schema})`))
.rows;
FROM INFORMATION_SCHEMA.COLUMNS c
where table_schema in (${schema})
order by ordinal_position`)).rows;
entities.forEach(ent => {
response
.filter(filterVal => filterVal.table_name === ent.tsEntityName)