news-analyze/createDatabase.ts
吳元皓 5bf857f3cd feat: enhance UI components and add accordion functionality
- Updated DraggableWindow.vue to improve shadow effects.
- Refactored AboutWindow.vue for better structure and readability.
- Added chatbot functionality in chatbot.vue with cookie management.
- Improved navigation component for better code clarity.
- Created a new chat history table in the database schema.
- Modified error handling in error.vue to display error messages correctly.
- Integrated ChatbotWindow into the desktop application layout.
- Implemented accordion component in home.vue for Q/A section.
- Enhanced API for chat functionality with improved error handling.
- Removed unused routes for cleaner codebase.
- Added custom animations for accordion components in tailwind.config.js.
- Developed accordion UI components (Accordion, AccordionContent, AccordionItem, AccordionTrigger) for better user interaction.
2025-05-13 09:40:37 +08:00

65 lines
1.5 KiB
TypeScript

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,
username text not null unique,
oauthProvider text not null,
avatarUrl text not null,
email text not null,
oauthProviderGivenId text not null
);
`;
const createNewsProviders = await sql`
create table if not exists newsProviders (
uuid text primary key,
title text not null,
slug text unique,
website text not null,
description text not null,
facebookUrl text,
twitterUrl text,
threadsUrl text,
logoUrl text not null,
lean text not null
)
`;
const createNewsProvidersZh = await sql`
create table if not exists newsProvidersZh (
uuid text primary key,
title text not null,
slug text unique,
website text not null,
description text not null,
facebookUrl text,
twitterUrl text,
threadsUrl text,
logoUrl text not null,
lean text not null
)
`;
const createGoLinks = await sql`
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
}
`;
const createUserAiChatHistory = await sql`
CREATE TABLE IF NOT EXISTS chat_history (
id SERIAL PRIMARY KEY,
uuid VARCHAR(255) NOT NULL,
role VARCHAR(50) NOT NULL,
content TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)`;
console.log("Creation Complete");