Skip to content

postgrelize / ForeignKeyOptions

Type Alias: ForeignKeyOptions ​

ForeignKeyOptions = Readonly<{ allowNull?: boolean; field?: string; name?: string; }>

Defined in: src/associations/types.ts:23

Foreign key given as an object instead of a plain name.

Example ​

ts
const fk: ForeignKeyOptions = { name: 'authorId', field: 'author_id', allowNull: false };
User.hasMany(Post, { foreignKey: fk });

Released under the MIT License.