Skip to main content

Miscellaneous

Use [[#BaseModel.timestamps]] to add created_at and updated_at to the table.

User.timestamps();
User.timestamps();
User.timestamps()

If [[#BaseModel.archive]] is true, deleted records are archived in the _Archive table.

User.archive = true;
const count = await User.delete({ age: 27 });
// _Archive will have delete records as
// { model: 'User', data: <deleted user 1> },
// { model: 'User', data: <deleted user 2> }, ...
User.archive = true;
const count = await User.delete({ age: 27 });
// _Archive will have delete records as
// { model: 'User', data: <deleted user 1> },
// { model: 'User', data: <deleted user 2> }, ...
User.archive = true
count = await User.delete age: 27
# _Archive will have delete records as
# { model: 'User', data: <deleted user 1> },
# { model: 'User', data: <deleted user 2> }, ...