Update config/migrate-terms-timestamp.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Marco Beretta 2025-12-07 03:57:02 +01:00 committed by GitHub
parent 24689b99a1
commit 4fe9e98442
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -62,6 +62,9 @@ const connect = require('./connect');
try {
// Use createdAt as fallback for termsAcceptedAt
const termsAcceptedAt = user.createdAt || new Date();
if (!user.createdAt) {
console.yellow(`Warning: User ${user._id} has no createdAt, using current date for termsAcceptedAt`);
}
await User.updateOne({ _id: user._id }, { $set: { termsAcceptedAt } });
migratedCount++;