Skip to content

Access old values in beforeUpdate ? #94

@getvega

Description

@getvega

Given a model

export default class User extends Model {
    static tableName = 'users';
    async $beforeValidate() {
        console.log('beforeValidate', this, arguments);
    }
    async $afterValidate() {
        console.log('afterValidate', this, arguments);
    }
    async $beforeUpdate() {
        console.log('beforeUpdate', this, arguments);
    }
    async $afterUpdate() {
        console.log('afterUpdate', this, arguments);
    }
}

// then
const user = await User.query().insert({ a: 1 });
await user.$query().patch({ a: 2 });

Seems like I never have the old value { a: 1 } in thisor json. Is it possible?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions