fix: use drizzle

This commit is contained in:
2025-01-07 14:39:12 +01:00
parent 811dccfe16
commit 8292084341
14 changed files with 2665 additions and 1099 deletions

View File

@@ -1,4 +1,9 @@
import { integer, pgTable, serial, timestamp, varchar } from 'drizzle-orm/pg-core';
import { drizzle } from 'drizzle-orm/postgres-js';
import postgres from 'postgres';
const client = postgres('postgresql://postgres:postgres@db:5432/db');
export const db = drizzle(client, {});
export const topics = pgTable('topics', {
id: serial('id').primaryKey(),
@@ -16,14 +21,6 @@ export const universities = pgTable('universities', {
updatedAt: timestamp('updated_at').defaultNow()
});
export const courses = pgTable('courses', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
universityId: integer('university_id').references(() => universities.id),
createdAt: timestamp('created_at').defaultNow(),
updatedAt: timestamp('updated_at').defaultNow()
});
export const certificates = pgTable('certificates', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
@@ -32,17 +29,18 @@ export const certificates = pgTable('certificates', {
updatedAt: timestamp('updated_at').defaultNow()
});
export const books = pgTable('books', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
progress: integer('progress').default(0),
createdAt: timestamp('created_at').defaultNow(),
updatedAt: timestamp('updated_at').defaultNow()
});
export const publications = pgTable('publications', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
createdAt: timestamp('created_at').defaultNow(),
updatedAt: timestamp('updated_at').defaultNow()
});
export const tasks = pgTable('topics', {
id: serial('id').primaryKey(),
name: varchar('name', { length: 256 }),
createdAt: timestamp('created_at').defaultNow(),
updatedAt: timestamp('updated_at').defaultNow()
});