Skip to content

Commit

Permalink
chore: Make Build a paranoid model (enable soft deletion) #4366
Browse files Browse the repository at this point in the history
  • Loading branch information
svenaas committed Jan 18, 2024
1 parent 8501ae6 commit 0c232fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/models/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ module.exports = (sequelize, DataTypes) => {
afterCreate,
afterUpdate,
},
paranoid: true,
}
);

Expand Down
9 changes: 9 additions & 0 deletions migrations/20240103173046-add-paranoid-to-build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const TABLE = 'build';

exports.up = async db => {
await db.addColumn(TABLE, 'deletedAt', { type: 'date', allowNull: true });
};

exports.down = async db => {
db.removeColumn(TABLE, 'deletedAt');
};

0 comments on commit 0c232fb

Please sign in to comment.