Skip to content

I'm not getting a way to remove an association between these two models below: #1188

Open
@engmsilva

Description

@engmsilva

I'm not getting a way to remove an association between these two models below:

@Table
class Ticket extends Model {
  @PrimaryKey
  @AutoIncrement
  @Column
  id: number;

  @ForeignKey(() => Queue)
  @Column
  queueId: number;

  @BelongsTo(() => Queue)
  queue: Queue;
  
}
@Table
class Queue extends Model {
  @PrimaryKey
  @AutoIncrement
  @Column
  id: number;
}

To associate a Queue to a Ticket I do the following:

const queueId = 1;
await Ticket.findByPk(ticket.id).then(async ticket => {
          await ticket.update({
            queueId
          });
ticket.reload();
  });

Any ideas on how to remove this association?

Originally posted by @engmsilva in #774 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions