- Remove BMAD framework, IDE configs, dev screenshots, test files, internal docs, and backup files - Rename keep-notes/ to memento-note/ - Update all references from keep-notes to memento-note - Add Apache 2.0 license with Commons Clause (non-commercial restriction) - Add clean .gitignore and .env.docker.example
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { PrismaClient } from '../prisma/client-generated'
|
|
|
|
const prisma = new PrismaClient()
|
|
|
|
async function main() {
|
|
console.log('Updating user settings to show recent notes...')
|
|
|
|
const updateResult = await prisma.userAISettings.updateMany({
|
|
data: {
|
|
showRecentNotes: true
|
|
}
|
|
})
|
|
|
|
console.log(`Updated ${updateResult.count} user settings.`)
|
|
|
|
// Verify and Create missing
|
|
const users = await prisma.user.findMany({
|
|
include: { aiSettings: true }
|
|
})
|
|
|
|
for (const u of users) {
|
|
if (!u.aiSettings) {
|
|
console.log(`User ${u.id} has no settings. Creating default...`)
|
|
await prisma.userAISettings.create({
|
|
data: {
|
|
userId: u.id,
|
|
showRecentNotes: true
|
|
}
|
|
})
|
|
console.log(`Created settings for ${u.id}`)
|
|
} else {
|
|
console.log(`User ${u.id}: showRecentNotes = ${u.aiSettings.showRecentNotes}`)
|
|
}
|
|
}
|
|
}
|
|
|
|
main()
|
|
.catch(e => console.error(e))
|
|
.finally(async () => await prisma.$disconnect())
|