8117253841
Phase 1 of the parent/child rollup feature. Self-FK on properties with ON DELETE RESTRICT, plus a CHECK that blocks self-reference at the DB level. Service-layer helpers (getDescendantIds, getAncestorIds, assertNoCycle) walk the tree via recursive CTEs and guard against cycles and cross-company parents. softDeleteProperty now refuses to delete a property with live children. No UI yet — readers and roll-up routes land in Phase 2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
drizzle migrations
This directory holds SQL migrations generated by drizzle-kit generate from the
TypeScript schema in src/lib/server/db/schema/.
Commands:
pnpm run db:generate— diff the schema vs. the latest snapshot and emit a new.sqlfilepnpm run db:migrate— apply pending migrations toDATABASE_URLpnpm run db:push— skip migrations and sync the schema directly (dev only)pnpm run db:studio— open the Drizzle Studio UI
After every generate, review the SQL for surprises — especially around:
- enum additions (non-blocking) vs. removals (require a separate data migration)
- index changes on large tables (use
CONCURRENTLYin production rollouts) - anything touching
assets.custom_fields— seeproject_buildfor_life_ops.mdmemory for the immutable-key policy.