pass

Attempt 1 of 10

all 1 assertion(s) passed

trigger.negative.reverse.database_schema67.4 s25/6628 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 comprehensive multi-tenant invoicing schema with proper isolation strategy.
  2. Write{"content":"-- Multi-tenant invoicing system schema with Row-Level Security\n-- Tenant isolation via organisation_id + RLS policies\n\n-- ======================…
  3. Write
  4. Write{"content":"# Multi-Tenant Invoicing Schema Design\n\n## Overview\n\nThis is a **row-level security (RLS)** based multi-tenant design for a PostgreSQL invoicing…
  5. Write
  6. assistant_messageI've designed a production-ready multi-tenant invoicing schema. Here's the summary: ## Key Design Decisions **Tenant Isolation: PostgreSQL Row-Level Security (RLS)** - Every table has an `organisation_id` column - RLS policies enforce that queries only see data for the current tenant - Application sets `SET app.current_organisation_id = 'tenant-uuid'` at connection time - Isolation happens at the database layer—bugs can't leak data across tenants **Tables** - **organisations** — the tenants - **users** — org members with roles (admin/user/viewer) - **customers** — customer records per org - **invoices** — with unique_id per org, multi-currency support, workflow status - **line_items** — items in an invoice with denormalized `amount_cents` for performance - **payments** — support partial payments, multiple payment methods, status tracking **Amounts as Integers** - All prices stored in cents (BIGINT) to avoid floating-point precision issues - Easier calculations, simpler currency handling **Indexes** - Composite indexes follow `(organisation_id, filter_column)` pattern - Ensures RLS filter hits the index first - Covers common queries: by customer, status, date ranges - Partial indexes on nullable fields (e.g., only index completed payments) **Data Integrity** - Foreign keys enforce references within same org (via triggers) - RESTRICT deletes prevent accidental data loss (force explicit archive) - Cascading deletes only for children (invoices → line_items) - Auto-updated `updated_at` timestamps on all tables **Unique Constraints** - `invoice_number` is unique per organisation (not global) - `email` is unique per organisation (reusable across tenants) - `slug` is global for org lookup The schema is in `invoicing_schema.sql` and design details (migrations, scaling notes, RBAC setup) are in `SCHEMA_DESIGN.md`.
  7. session_endcompleted

What it touched

Writes

  • SCHEMA_DESIGN.md
  • invoicing_schema.sql

Deletes

nothing observed

Network

nothing observed

Back to the scorecard