optimize post migration
This commit is contained in:
@@ -1752,21 +1752,21 @@ export async function migrate(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
// ── 30. user_configs: identity + OTP store (superuser-only) ──
|
||||
// Holds the rotating one-time code, colour, and the OTP-issue timestamp used
|
||||
// for the 20-minute window. Sensitive (OTPs) → not public; read/written via
|
||||
// ── 30. otp: OTP store (superuser-only) ──
|
||||
// Holds the rotating one-time code and the OTP-issue timestamp used for the
|
||||
// 20-minute join window. Sensitive (OTPs) → not public; read/written via
|
||||
// createSuperClient in SvelteKit. `created`/`updated` are PB built-ins; the
|
||||
// manual `updatedAt` is written ONLY on OTP (re)issue so the window stays
|
||||
// accurate (colour edits must not bump it). userId links to the users auth
|
||||
// record so each child's config is uniquely addressable.
|
||||
// accurate. userId links to the users auth record so each child's config is
|
||||
// uniquely addressable. (Display colour lives on users.color, not here.)
|
||||
{
|
||||
if (!(await getCollection("user_configs"))) {
|
||||
if (!(await getCollection("otp"))) {
|
||||
const famsCol = await getCollection("fams");
|
||||
const usersCol = await getCollection("users");
|
||||
if (!famsCol || !usersCol) throw new Error("fams/users collection not found");
|
||||
console.log("[migrate] Creating user_configs collection...");
|
||||
console.log("[migrate] Creating otp collection...");
|
||||
await createCollection({
|
||||
name: "user_configs",
|
||||
name: "otp",
|
||||
type: "base",
|
||||
listRule: null,
|
||||
viewRule: null,
|
||||
@@ -1791,12 +1791,11 @@ export async function migrate(): Promise<void> {
|
||||
cascadeDelete: false,
|
||||
},
|
||||
{ name: "otp", type: "text", required: false },
|
||||
{ name: "colour", type: "text", required: false },
|
||||
{ name: "updatedAt", type: "text", required: false },
|
||||
],
|
||||
});
|
||||
} else {
|
||||
console.log(" ↳ user_configs already exists");
|
||||
console.log(" ↳ otp already exists");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user