fix(database): id is not generated when custom primary key
This commit is contained in:
parent
34c9ec123e
commit
1f431dc2d6
@ -7,7 +7,7 @@ import {
|
|||||||
QueryInterfaceDropTableOptions,
|
QueryInterfaceDropTableOptions,
|
||||||
SyncOptions,
|
SyncOptions,
|
||||||
Transactionable,
|
Transactionable,
|
||||||
Utils,
|
Utils
|
||||||
} from 'sequelize';
|
} from 'sequelize';
|
||||||
import { Database } from './database';
|
import { Database } from './database';
|
||||||
import { Field, FieldOptions } from './fields';
|
import { Field, FieldOptions } from './fields';
|
||||||
@ -200,6 +200,10 @@ export class Collection<
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.options.autoGenId !== false && options.primaryKey) {
|
||||||
|
this.model.removeAttribute('id');
|
||||||
|
}
|
||||||
|
|
||||||
this.removeField(name);
|
this.removeField(name);
|
||||||
this.fields.set(name, field);
|
this.fields.set(name, field);
|
||||||
this.emit('field.afterAdd', field);
|
this.emit('field.afterAdd', field);
|
||||||
|
Loading…
Reference in New Issue
Block a user