title: TypeORM check if column has changed
body: <p>So, I'm using TypeORM with the ActiveRecord pattern and have this entity</p>
  <pre class="lang-js prettyprint-override"><code>@Entity()
  export class User {
    @PrimaryGeneratedColumn()
    public id: number;
  
    @Column()
    public username: string;
  
    @Column()
    public password: string;
  
    @BeforeInsert()
    public async hashPassword() {
      this.password = await hashPassword(this.password);
    }
  
  }
  </code></pre>
  <p>now what I want to accomplish is rehashing my password when any given User changes BUT only if the password field changed. I have seen some answers where I should store the tempPassword as a field in the User class but if for some reason the server goes down I would lose that data. I have also seen some people suggest the Subscriber thing typeorm has and im interested in that but not exactly sure how I would implement this with that.
  for reference this is how I would do what I want to do with mongoose</p>
  <pre class="lang-js prettyprint-override"><code>UserSchema.pre(&quot;save&quot;, function(next) {
    if (this.isModified(&quot;password&quot;) || this.isNew) {
      // hash the password
    }
  })
  </code></pre>
  <p>any help is appreciated</p>