/**
 * Soft-delete for personal_notes — Daniel asked for "deleted notes go to
 * trash" so a slip of the finger doesn't lose work. Adds a deleted_at
 * timestamp; NULL means active. Trash listing filters by NOT NULL,
 * regular listing filters by NULL.
 *
 * Restore = clear deleted_at. Empty Trash = real DELETE. No retention
 * policy yet — items stay in trash until the user empties it.
 */

exports.up = (pgm) => {
  pgm.addColumn('personal_notes', {
    deleted_at: { type: 'timestamptz', notNull: false, default: null },
  });
  pgm.createIndex('personal_notes', ['user_id', 'deleted_at']);
};

exports.down = (pgm) => {
  pgm.dropIndex('personal_notes', ['user_id', 'deleted_at']);
  pgm.dropColumn('personal_notes', 'deleted_at');
};
