refactor(database): 🎨 Update database and schema names to be clearer

This commit is contained in:
Jesse Wierzbinski 2024-04-16 20:36:01 -10:00
parent 9081036c6d
commit 88b3ec7b43
No known key found for this signature in database
92 changed files with 6785 additions and 1018 deletions

View file

@ -6,7 +6,7 @@ import { Meilisearch } from "meilisearch";
import type { Status } from "~database/entities/Status";
import type { User } from "~database/entities/User";
import { db } from "~drizzle/db";
import { status, user } from "~drizzle/schema";
import { Notes, Users } from "~drizzle/schema";
export const meilisearch = new Meilisearch({
host: `${config.meilisearch.host}:${config.meilisearch.port}`,
@ -83,7 +83,7 @@ export const getNthDatabaseAccountBatch = (
n: number,
batchSize = 1000,
): Promise<Record<string, string | Date>[]> => {
return db.query.user.findMany({
return db.query.Users.findMany({
offset: n * batchSize,
limit: batchSize,
columns: {
@ -101,7 +101,7 @@ export const getNthDatabaseStatusBatch = (
n: number,
batchSize = 1000,
): Promise<Record<string, string | Date>[]> => {
return db.query.status.findMany({
return db.query.Notes.findMany({
offset: n * batchSize,
limit: batchSize,
columns: {
@ -123,7 +123,7 @@ export const rebuildSearchIndexes = async (
.select({
count: count(),
})
.from(user)
.from(Users)
)[0].count;
for (let i = 0; i < accountCount / batchSize; i++) {
@ -156,7 +156,7 @@ export const rebuildSearchIndexes = async (
.select({
count: count(),
})
.from(status)
.from(Notes)
)[0].count;
for (let i = 0; i < statusCount / batchSize; i++) {

View file

@ -15,7 +15,7 @@ export async function fetchTimeline<T extends User | Status | Notification>(
args:
| Parameters<typeof findManyNotes>[0]
| Parameters<typeof findManyUsers>[0]
| Parameters<typeof db.query.notification.findMany>[0],
| Parameters<typeof db.query.Notifications.findMany>[0],
req: Request,
) {
// BEFORE: Before in a top-to-bottom order, so the most recent posts