fix bugged primary key change with auto_increment
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
1e396b5934
commit
56fb927c74
1 changed files with 11 additions and 2 deletions
|
@ -126,9 +126,9 @@ export class Handler {
|
|||
const k = key[i];
|
||||
if (
|
||||
((k.REFERENCED_TABLE_NAME ?? k.referenced_table_name) == table
|
||||
&& (k.REFERENCED_COLUMN_NAME ?? k.referenced_column_name).toLowerCase() == attr.toLowerCase())
|
||||
&& (k.REFERENCED_COLUMN_NAME ?? k.referenced_column_name).toLowerCase() == attr.toLowerCase())
|
||||
|| (start && (k.TABLE_NAME ?? k.table_name) == table
|
||||
&& (k.COLUMN_NAME ?? k.column_name).toLowerCase() == attr.toLowerCase() && (k.REFERENCED_COLUMN_NAME ?? k.referenced_column_name) != null)
|
||||
&& (k.COLUMN_NAME ?? k.column_name).toLowerCase() == attr.toLowerCase() && (k.REFERENCED_COLUMN_NAME ?? k.referenced_column_name) != null)
|
||||
) {
|
||||
del.appendEnding(handler.querys.removeForeignKey(handler, (k.TABLE_NAME ?? k.table_name), (k.CONSTRAINT_NAME ?? k.constraint_name)));
|
||||
key.splice(i--, 1);
|
||||
|
@ -223,6 +223,15 @@ export class Handler {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (changePrimary) for (let j = 0; j < keys.length; j++) {
|
||||
const a = table.dbLangTableAttributes[keys[j]];
|
||||
if (a.ops.autoIncrement) {
|
||||
a.ops.autoIncrement = false;
|
||||
create.appendEnding(handler.querys.changeColumn(handler, a));
|
||||
a.ops.autoIncrement = true;
|
||||
connst.appendEnding(handler.querys.changeColumn(handler, a));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changePrimary) {
|
||||
create.appendEnding(handler.querys.removePrimaryKey(handler, table.dbLangTableName));
|
||||
|
|
Loading…
Reference in a new issue