Add production-ready SuperAdmin API features for tenants, SMS, servers, and plugins.
Includes mobile auth, get_user/get_version, SMS wallet parity endpoints, appearance backfill, and related Prisma migrations. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
const { PrismaClient } = require('@prisma/client');
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
const rows = await prisma.tenant.findMany({
|
||||
select: { id: true, notes: true, appVersion: true },
|
||||
});
|
||||
|
||||
let n = 0;
|
||||
for (const row of rows) {
|
||||
const match = String(row.notes || '').match(/version:([^|\s]+)/i);
|
||||
if (!match?.[1]) continue;
|
||||
if (row.appVersion && row.appVersion !== '1') continue;
|
||||
|
||||
await prisma.tenant.update({
|
||||
where: { id: row.id },
|
||||
data: { appVersion: match[1].trim() },
|
||||
});
|
||||
n += 1;
|
||||
}
|
||||
|
||||
console.log(`backfilled ${n} of ${rows.length}`);
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user