From f5734e7e5d6446c6949fa9c642e9644ea1d1b757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B3=E5=85=83=E7=9A=93?= Date: Tue, 13 May 2025 23:20:38 +0800 Subject: [PATCH] Fix SQL errors. --- createDatabase.ts | 11 +++++++---- server/components/postgres.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/createDatabase.ts b/createDatabase.ts index 9259f64..90fddd5 100644 --- a/createDatabase.ts +++ b/createDatabase.ts @@ -3,7 +3,7 @@ import sql from "~/server/components/postgres"; const createUsers = await sql` create table if not exists users ( uuid text primary key, - created_at timestampz default current_timestamp, + created_at timestamptz default current_timestamp, username text not null unique, oauthProvider text not null, avatarUrl text not null, @@ -43,13 +43,13 @@ create table if not exists newsProvidersZh ( `; const createGoLinks = await sql` -create table if not exists go_links { +create table if not exists go_links ( uuid text primary key, title text, slug text unique not null, forwardUrl text not null, - created_at timestampz default current_timestamp -} + created_at timestamptz default current_timestamp +) `; const createUserAiChatHistory = await sql` @@ -62,3 +62,6 @@ CREATE TABLE IF NOT EXISTS chat_history ( )`; console.log("Creation Complete"); + +await sql.end(); +process.exit(0) \ No newline at end of file diff --git a/server/components/postgres.ts b/server/components/postgres.ts index 37619d6..6d6bb2b 100644 --- a/server/components/postgres.ts +++ b/server/components/postgres.ts @@ -1,5 +1,5 @@ import SQL from "postgres"; -const postgres = SQL(`${process.env.POSTGRES_URL || ""}}`); +const postgres = SQL(`${process.env.POSTGRES_URL || ""}`); export default postgres;