{
  "schema": "DAT002_LAB_MODEL_CONTRACT_v1",
  "lesson_id": "DAT-002",
  "lab_id": "DAT002-LAB1",
  "starter_must_not_pre_solve_skill": true,
  "required_invariants": [
    {
      "id": "I1",
      "rule": "orders.customer_id is required and references an existing customers.id",
      "expected_mechanisms": [
        "NOT NULL",
        "named FOREIGN KEY"
      ]
    },
    {
      "id": "I2",
      "rule": "orders.external_ref is required and unique",
      "expected_mechanisms": [
        "NOT NULL",
        "named UNIQUE"
      ]
    },
    {
      "id": "I3",
      "rule": "orders.amount is required and greater than zero",
      "expected_mechanisms": [
        "NOT NULL",
        "named CHECK"
      ]
    },
    {
      "id": "I4",
      "rule": "orders.status is required and is one of pending/paid/cancelled; DEFAULT 'pending' alone is insufficient",
      "expected_mechanisms": [
        "NOT NULL",
        "DEFAULT stays as convenience",
        "named CHECK"
      ]
    },
    {
      "id": "I5",
      "rule": "maintained constraints use stable explicit names",
      "expected_mechanisms": [
        "CONSTRAINT <name>"
      ]
    },
    {
      "id": "I6",
      "rule": "one deliberate pre-existing negative amount must make CHECK validation fail until repaired",
      "expected_mechanisms": [
        "CHECK ... NOT VALID",
        "VALIDATE CONSTRAINT after repair"
      ]
    },
    {
      "id": "I7",
      "rule": "operational statements remain exact-subcommand bounded",
      "expected_mechanisms": [
        "source-backed caveat",
        "no zero-downtime claim"
      ]
    }
  ],
  "not_valid_supported_required_types": [
    "FOREIGN KEY",
    "CHECK"
  ],
  "not_valid_forbidden_in_this_lab": [
    "UNIQUE",
    "PRIMARY KEY"
  ],
  "artifact_schema": "CONSTRAINT_FIRST_POSTGRESQL_DDL_RECORD_v1",
  "source_ids": [
    "PG18-CREATE-TABLE",
    "PG18-CONSTRAINTS",
    "PG18-ALTER-TABLE"
  ],
  "runtime_evidence_required_for_completion": true,
  "production_migration_claims_forbidden": true
}
