mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
24 lines
448 B
TypeScript
24 lines
448 B
TypeScript
import connectDB, { User } from '@linux-odyssey/models'
|
|
|
|
async function migrate() {
|
|
await connectDB(
|
|
process.env.MONGO_URL || 'mongodb://localhost:27017/odyssey-test'
|
|
)
|
|
await User.updateMany(
|
|
{
|
|
isGuest: { $exists: false },
|
|
},
|
|
{ $set: { isGuest: false } }
|
|
)
|
|
}
|
|
|
|
migrate()
|
|
.then(() => {
|
|
console.log('Migration completed')
|
|
process.exit(0)
|
|
})
|
|
.catch((err) => {
|
|
console.error(err)
|
|
process.exit(1)
|
|
})
|