Add vanity code label

This commit is contained in:
KaKi87 2022-03-05 17:08:10 +01:00
parent 83735b7239
commit 2397b215be
2 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@ const codes = Array.from({ length: parseInt(Deno.args[0]) }, () => nanoid({ size
await db.queryArray(`
INSERT INTO "vanityCode"
VALUES ${codes.map((_, index) => `($${index+1})`).join(',')}
`, codes);
VALUES ${codes.map((_, index) => `($${index+2}, $1)`).join(',')}
`, [Deno.args[1], ...codes]);
console.log(codes.join('\n'));

View File

@ -17,5 +17,6 @@ CREATE TABLE "setting" (
INSERT INTO "setting" ("key", "value") VALUES ('idSize', 3);
CREATE TABLE "vanityCode" (
"code" VARCHAR(30) PRIMARY KEY
"code" VARCHAR(30) PRIMARY KEY,
"label" VARCHAR(20)
);