diff --git a/database/migrations/0009-login_users_plug_holes.ts b/database/migrations/0009-login_users_plug_holes.ts new file mode 100644 index 000000000..dc13ab671 --- /dev/null +++ b/database/migrations/0009-login_users_plug_holes.ts @@ -0,0 +1,17 @@ +/* MIGRATION TO CLEAN PRODUCTION DATA + * + * some entries in the login_users table are inconsistent. + * As solution the inconsistent data is purged and the corresponding + * account is set as not yet activated + */ + +export async function upgrade(queryFn: (query: string, values?: any[]) => Promise>) { + // Remove incomplete data and set account as not activated yet. + await queryFn( + `UPDATE login_users SET password = 0, pubkey = NULL, email_checked = 0 WHERE privkey IS NULL;`, + ) +} + +export async function downgrade(queryFn: (query: string, values?: any[]) => Promise>) { + return [] // cannot undelete things +}