Skip to content

Commit

Permalink
TypeScript: may field optional if autoIncrement instead of `primary…
Browse files Browse the repository at this point in the history
…Key` (#572)
  • Loading branch information
steveschmitt committed Dec 4, 2021
1 parent 4636736 commit 3a3ad4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/auto-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ export class AutoGenerator {
const fields = _.keys(this.tables[table]);
return fields.filter((field): boolean => {
const fieldObj = this.tables[table][field];
return fieldObj.allowNull || (!!fieldObj.defaultValue || fieldObj.defaultValue === "") || fieldObj.primaryKey
return fieldObj.allowNull || (!!fieldObj.defaultValue || fieldObj.defaultValue === "") || fieldObj.autoIncrement
|| this.isTimestampField(field);
});
}
Expand Down

0 comments on commit 3a3ad4b

Please sign in to comment.