Migrate architecture to PostgreSQL for Swarm HA
This commit is contained in:
1 parent
ee28968a70
commit
2317f9f133
39 files changed
+3849
-10
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
const prisma = new PrismaClient({
|
||||
datasources: {
|
||||
db: {
|
||||
url: 'file:dev.db'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
async function main() {
|
||||
console.log('Clearing data...')
|
||||
|
||||
// 1. Delete all ApprovalLogs
|
||||
await prisma.approvalLog.deleteMany({})
|
||||
console.log('Cleared all ApprovalLogs')
|
||||
|
||||
// 2. Delete all Requests
|
||||
await prisma.request.deleteMany({})
|
||||
console.log('Cleared all Requests')
|
||||
|
||||
// 3. Delete ActivityLogs to clear history page completely
|
||||
await prisma.activityLog.deleteMany({})
|
||||
console.log('Cleared all ActivityLogs')
|
||||
|
||||
// 4. Reset all Item quantities to 0
|
||||
await prisma.item.updateMany({
|
||||
data: {
|
||||
totalQuantity: 0,
|
||||
borrowedQty: 0,
|
||||
trialQty: 0,
|
||||
billedQty: 0,
|
||||
availableQty: 0,
|
||||
damagedQty: 0,
|
||||
soldQty: 0,
|
||||
}
|
||||
})
|
||||
console.log('Reset all item quantities to 0')
|
||||
|
||||
console.log('Done!')
|
||||
}
|
||||
|
||||
main()
|
||||
.catch(console.error)
|
||||
.finally(() => prisma.$disconnect())
|
||||
Reference in new issue
Block a user