From ed98aefecd33d2552adcb06ce4e06f29649fcb41 Mon Sep 17 00:00:00 2001 From: grabowski Date: Wed, 15 Apr 2026 09:56:48 +0700 Subject: [PATCH] Add personal, Thai address, and emergency contact columns to employees 14 new nullable columns on the employees table: Personal: - dateOfBirth, gender, nationality, maritalStatus Address (Thai-specific): - addressLine1, addressLine2, subdistrict (Tambon), district (Amphoe), province (Changwat), postalCode, country Emergency contact: - emergencyContactName, emergencyContactPhone, emergencyContactRelationship All nullable to leave existing rows intact. Constrained sets (gender, marital status) live in the UI selects rather than pgEnums for flexibility. Form/UI/export updates follow. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/lib/server/db/schema.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/lib/server/db/schema.ts b/src/lib/server/db/schema.ts index 642e305..68f9680 100644 --- a/src/lib/server/db/schema.ts +++ b/src/lib/server/db/schema.ts @@ -215,6 +215,23 @@ export const employees = pgTable('employees', { taxId: text('tax_id'), bankName: text('bank_name'), bankAccount: text('bank_account'), + // Personal + dateOfBirth: date('date_of_birth'), + gender: text('gender'), + nationality: text('nationality'), + maritalStatus: text('marital_status'), + // Address (Thai-specific) + addressLine1: text('address_line_1'), + addressLine2: text('address_line_2'), + subdistrict: text('subdistrict'), + district: text('district'), + province: text('province'), + postalCode: text('postal_code'), + country: text('country'), + // Emergency contact + emergencyContactName: text('emergency_contact_name'), + emergencyContactPhone: text('emergency_contact_phone'), + emergencyContactRelationship: text('emergency_contact_relationship'), isActive: boolean('is_active').notNull().default(true), deletedAt: timestamp('deleted_at', { withTimezone: true }), createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),