From f39777d25574daaf774a1f217c8668edc251754d Mon Sep 17 00:00:00 2001 From: Moon Date: Thu, 27 Jul 2023 01:56:23 +0000 Subject: [PATCH] if not exists on table create --- main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.ts b/main.ts index 85a71d7..3237306 100644 --- a/main.ts +++ b/main.ts @@ -10,7 +10,7 @@ const db = new DB("scrappy.db"); const command = Deno.args[0]; if (command === "create") { - db.execute(`create table channel (id INTEGER PRIMARY KEY AUTOINCREMENT, channel_id text not null unique, channel_name text not null, last_seen_at number not null default 0);`); + db.execute(`create table if not exists channel (id INTEGER PRIMARY KEY AUTOINCREMENT, channel_id text not null unique, channel_name text not null, last_seen_at number not null default 0);`); } else if (command === "new" && Deno.args.length == 3) { const channelId = Deno.args[1];