mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-07 14:28:09 +03:00
Scripting
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import db from "../db/db";
|
||||
import CreateLogCtx from "../logger";
|
||||
|
||||
const logger = CreateLogCtx("scripts/initialise-counters.ts");
|
||||
|
||||
(async () => {
|
||||
let users = await db.counters.findOne({
|
||||
counterName: "users",
|
||||
});
|
||||
|
||||
if (users) {
|
||||
throw new Error(`"users" document already exists, exiting.`);
|
||||
}
|
||||
|
||||
await db.counters.insert({
|
||||
counterName: "users",
|
||||
value: 0,
|
||||
});
|
||||
|
||||
logger.info("Successfully initialised counter documents. Exiting.");
|
||||
process.exit(0);
|
||||
})();
|
||||
Reference in New Issue
Block a user