work-hub-server/openspec/changes/swap-superstruct-valibot/tasks.md
Nicolas HOARAU 9314e72f3e feat(schema): add shared schema package with Drizzle ORM and Valibot validation
Create @workspace/schema package with Project and Task table definitions, Drizzle relations, Valibot validation schemas (select/insert/update), and wire as workspace dependency in API and Web apps.
2026-06-04 12:46:51 +04:00

1 KiB

1. Dependency swap

  • 1.1 Remove superstruct from packages/schema/package.json dependencies
  • 1.2 Add valibot to packages/schema/package.json dependencies

2. Create Valibot schemas

  • 2.1 Create packages/schema/src/valibot.ts with createInsertSchema and createUpdateSchema for projects and tasks
  • 2.2 Add picklist() refinements for enum fields (status, priority) using the constant arrays from drizzle/enums.ts
  • 2.3 Export insert and update schemas as named exports

3. Remove old modules

  • 3.1 Delete packages/schema/src/validation/ directory
  • 3.2 Delete packages/schema/src/types/ directory

4. Update barrel export

  • 4.1 Update packages/schema/src/index.ts to export Drizzle tables and Valibot schemas (remove old validation/types exports)

5. Verify

  • 5.1 Run pnpm --filter=@workspace/schema build to confirm compilation
  • 5.2 Run pnpm build from root to confirm full monorepo integrity
  • 5.3 Run pnpm --filter=api test to confirm no regressions