From 47bb8d9a972208e86db130af3573989698f31b74 Mon Sep 17 00:00:00 2001 From: Leandro Facchinetti Date: Fri, 12 Mar 2021 08:59:57 +0000 Subject: [PATCH] --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 9062472..ce68781 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,7 +51,7 @@ export default function killTheNewsletter( CREATE TRIGGER "feedsUpdatedAt" AFTER INSERT ON "entries" BEGIN - UPDATE "feeds" SET "updatedAt" = datetime('now') WHERE "id" = "NEW"."feed"; + UPDATE "feeds" SET "updatedAt" = CURRENT_TIMESTAMP WHERE "id" = "NEW"."feed"; END; `, ]); @@ -310,9 +310,11 @@ export default function killTheNewsletter(

`; + // TODO: Add references with a default value with is a call to a JavaScript function. const feedId = database.run( sql`INSERT INTO "feeds" ("reference", "title") VALUES (${reference}, ${req.body.name})` ).lastInsertRowid; + // TODO: Do this entry with a trigger. database.run( sql` INSERT INTO "entries" ("reference", "feed", "title", "author", "content") @@ -464,6 +466,7 @@ export default function killTheNewsletter( ` ); while (renderFeed(feedReference)!.length > 500_000) + // TODO: Does LIMIT 1 work in DELETE? database.run( sql`DELETE FROM "entries" WHERE "feed" = ${feed.id} ORDER BY "createdAt" ASC LIMIT 1` );