[Supplier] Phase 1: Database Schema & Initial Supplier Seeding #195

Closed
opened 2026-10-03 23:22:23 +00:00 by yuris · 0 comments
Owner

Overview

Establish the foundational data structures for supplier records, contact details, and price check timestamps in PostgreSQL via Drizzle ORM, and seed the initial verified workshop suppliers directly into the database.

Principles Applied

  • principle-foundational-thinking: Data structures and schema before downstream logic.
  • principle-laziness-protocol: Seed verified workshop suppliers directly into DB to avoid premature CRUD UI forms.

Scope & Tasks

  • Define suppliers table in apps/management/lib/db/schema.ts (id, code, name, category, description, picName, phone, address, invoiceTerms, lastCheckedAt, createdAt).
  • Generate and run Drizzle migration 0017_add_suppliers.sql.
  • Write seed script (scripts/seed-suppliers.ts) populating the 15 real workshop suppliers from existing purchase records.
  • Implement query helpers in apps/management/lib/suppliers/queries.ts linking suppliers to their historically purchased items.

Acceptance Criteria

  • Drizzle migration applies cleanly with zero errors.
  • Database contains 15 verified supplier records with complete contact metadata.
  • Query returns suppliers with their associated catalog items.
  • pnpm verify:management passes.
### Overview Establish the foundational data structures for supplier records, contact details, and price check timestamps in PostgreSQL via Drizzle ORM, and seed the initial verified workshop suppliers directly into the database. ### Principles Applied - `principle-foundational-thinking`: Data structures and schema before downstream logic. - `principle-laziness-protocol`: Seed verified workshop suppliers directly into DB to avoid premature CRUD UI forms. ### Scope & Tasks - Define `suppliers` table in `apps/management/lib/db/schema.ts` (id, code, name, category, description, picName, phone, address, invoiceTerms, lastCheckedAt, createdAt). - Generate and run Drizzle migration `0017_add_suppliers.sql`. - Write seed script (`scripts/seed-suppliers.ts`) populating the 15 real workshop suppliers from existing purchase records. - Implement query helpers in `apps/management/lib/suppliers/queries.ts` linking suppliers to their historically purchased items. ### Acceptance Criteria - [x] Drizzle migration applies cleanly with zero errors. - [x] Database contains 15 verified supplier records with complete contact metadata. - [x] Query returns suppliers with their associated catalog items. - [x] `pnpm verify:management` passes.
yuris changed title from [Pemasok] Phase 1: Database Schema & Initial Supplier Seeding to [Supplier] Phase 1: Database Schema & Initial Supplier Seeding 2026-10-03 23:23:16 +00:00
yuris closed this issue 2026-10-03 23:44:15 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/garage#195
No description provided.