feat: migrate entire codebase to TypeScript
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { drizzle } from 'drizzle-orm/postgres-js';
|
||||
import postgres from 'postgres';
|
||||
import logger from '../utils/logger.js';
|
||||
import { files } from './schema.js';
|
||||
import { files } from './schema';
|
||||
|
||||
const client = postgres(process.env.DATABASE_URL, {
|
||||
const client = postgres(process.env.DATABASE_URL!, {
|
||||
max: 10,
|
||||
idle_timeout: 20,
|
||||
connect_timeout: 10
|
||||
@@ -1,4 +1,5 @@
|
||||
import { pgTable, text, bigint, timestamp, uuid } from 'drizzle-orm/pg-core';
|
||||
import type { InferSelectModel, InferInsertModel } from 'drizzle-orm';
|
||||
|
||||
export const files = pgTable('files', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
@@ -14,4 +15,7 @@ export const files = pgTable('files', {
|
||||
uploaderId: bigint('uploader_id', { mode: 'number' }).notNull(),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at').defaultNow().notNull()
|
||||
});
|
||||
});
|
||||
|
||||
export type File = InferSelectModel<typeof files>;
|
||||
export type NewFile = InferInsertModel<typeof files>;
|
||||
Reference in New Issue
Block a user