Files
elegalsoftware/packages/db/src/schema/clients.ts
T

23 lines
709 B
TypeScript
Raw Normal View History

2026-04-26 02:42:42 -04:00
import { pgTable, uuid, text, timestamp, index } from 'drizzle-orm/pg-core';
import { firms } from './firms';
export const clients = pgTable(
'clients',
{
id: uuid('id').defaultRandom().primaryKey(),
firmId: uuid('firm_id')
.notNull()
.references(() => firms.id, { onDelete: 'cascade' }),
name: text('name').notNull(),
email: text('email'),
phone: text('phone'),
address: text('address'),
notes: text('notes'),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
},
(t) => ({
firmIdx: index('clients_firm_idx').on(t.firmId),
}),
);