pass

Attempt 1 of 10

all 1 assertion(s) passed

trigger.negative.reverse.database_schema24.4 s17/3441 tokens

Did the skill fire?

No — the skill never fired.

Observed Skill tool call in stream-json. No skill was invoked in this attempt.

What the agent did

  1. assistant_messageI'll design a production-grade multi-tenant invoicing schema with org-based isolation.
  2. Write{"content":"-- Multi-tenant invoicing system schema\n-- Tenant isolation: Row-level security via organisation_id\n-- All tables include org_id as the first colu…
  3. Write
  4. assistant_messageI've created a complete multi-tenant invoicing schema with these key design decisions: ## Schema Overview **Tables:** - `organisations` — the tenant/account holder - `users` — team members, scoped to org - `customers` — bill-to parties, scoped to org - `invoices` — core invoice document - `line_items` — invoice line details - `payments` — payment tracking with multiple payment methods ## Tenant Isolation Strategy **1. Column-based isolation (defense in depth)** - Every table includes `org_id` as the first column - Composite unique constraints include `org_id` (e.g., invoice numbers are unique per org, not globally) **2. Foreign key enforcement** - All references include implicit org_id checks: if you delete a customer, invoices can't exist without org matching - Prevents accidental cross-tenant data relationships **3. Row-level security (RLS)** - Use PostgreSQL policies to prevent SQL mistakes from leaking data - Application sets `app.org_id` session variable before queries - RLS policies enforce filtering automatically **4. Index strategy** - Composite indexes on `(org_id, status)`, `(org_id, customer_id)`, etc. for efficient filtering - Single-column org_id indexes as fallback - Date indexes on common query patterns (due dates, invoice dates) ## Key Details **Invoices** track: status progression (draft → sent → paid), tax/discount, paid amount to calculate remaining balance **Payments** are separate records (one invoice can have multiple partial payments) with method tracking and processor references **Line items** denormalize unit_price and line_total for reporting (avoids recalc if prices change later) **Users** include role-based access (admin/member) for access control in application layer The SQL file includes helper views for common queries: invoice summaries with aging buckets and payment history.
  5. session_endcompleted

What it touched

Writes

  • invoicing_schema.sql

Deletes

nothing observed

Network

nothing observed

Back to the scorecard