import { relations, sql } from "drizzle-orm";
import { char, mysqlTable, timestamp, varchar } from "drizzle-orm/mysql-core";
import { testTable } from "./test.schema";
export const usersTable = mysqlTable('users', {
id: char('userID', { length: 32 }).primaryKey(),
email: varchar('email', { length: 45 }).notNull(),
name: varchar('name', { length: 45 }).notNull(),
createdAt: timestamp('createdAt', { mode: 'date' }).default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updatedAt', { mode: 'date' }).default(sql`CURRENT_TIMESTAMP`)
});
export const userRelations = relations(usersTable, ({ one, many }) => ({
tests: many(testTable),
}));
import { relations, sql } from "drizzle-orm";
import { char, mysqlTable, timestamp, varchar } from "drizzle-orm/mysql-core";
import { testTable } from "./test.schema";
export const usersTable = mysqlTable('users', {
id: char('userID', { length: 32 }).primaryKey(),
email: varchar('email', { length: 45 }).notNull(),
name: varchar('name', { length: 45 }).notNull(),
createdAt: timestamp('createdAt', { mode: 'date' }).default(sql`CURRENT_TIMESTAMP`),
updatedAt: timestamp('updatedAt', { mode: 'date' }).default(sql`CURRENT_TIMESTAMP`)
});
export const userRelations = relations(usersTable, ({ one, many }) => ({
tests: many(testTable),
}));