perf improvements
This commit is contained in:
@@ -63,6 +63,9 @@ export const model: { [key: string]: string } = {
|
||||
last_edited_date TEXT
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_category ON Post (category);
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_published ON Post (published);
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_date ON Post (date);
|
||||
CREATE INDEX IF NOT EXISTS idx_posts_published_date ON Post (published, date);
|
||||
`,
|
||||
PostLike: `
|
||||
CREATE TABLE PostLike
|
||||
@@ -72,6 +75,7 @@ export const model: { [key: string]: string } = {
|
||||
post_id INTEGER NOT NULL
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_likes_user_post ON PostLike (user_id, post_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_likes_post_id ON PostLike (post_id);
|
||||
`,
|
||||
Comment: `
|
||||
CREATE TABLE Comment
|
||||
|
||||
@@ -105,6 +105,21 @@ export interface PostWithCommentsAndLikes {
|
||||
total_comments: number;
|
||||
last_edited_date?: string | null;
|
||||
}
|
||||
|
||||
export interface PostCardData {
|
||||
id: number;
|
||||
category: "blog" | "project";
|
||||
title: string;
|
||||
subtitle: string;
|
||||
banner_photo: string;
|
||||
date?: string | null;
|
||||
published: number;
|
||||
author_id: string;
|
||||
reads: number;
|
||||
attachments: string;
|
||||
total_likes: number;
|
||||
total_comments: number;
|
||||
}
|
||||
export interface PostWithTags {
|
||||
id: number;
|
||||
category: "blog" | "project"; // this is no longer used
|
||||
|
||||
Reference in New Issue
Block a user