model.ts 404 B

123456789101112131415
  1. /**
  2. * Returns the list of attributes that are part of the model's primary key.
  3. */
  4. export function getPrimaryKeyAttributes(model: ModelStatic<any>): ModelAttributeColumnOptions[] {
  5. const attributes: ModelAttributeColumnOptions[] = [];
  6. for (const attribute of Object.values(model.rawAttributes)) {
  7. if (attribute.primaryKey) {
  8. attributes.push(attribute);
  9. }
  10. }
  11. return attributes;
  12. }