{
  "id": "24d5b494-ea3c-4f12-acf7-06223055954d",
  "prevId": "336517ea-29ac-4c0d-86c2-d95c94b2eb88",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.accounts": {
      "name": "accounts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "platform_role_id": {
          "name": "platform_role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "avatar_url": {
          "name": "avatar_url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "password_hash": {
          "name": "password_hash",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "password_salt": {
          "name": "password_salt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "account_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "accounts_email_unique": {
          "name": "accounts_email_unique",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "accounts_platform_role_id_roles_id_fk": {
          "name": "accounts_platform_role_id_roles_id_fk",
          "tableFrom": "accounts",
          "tableTo": "roles",
          "columnsFrom": [
            "platform_role_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.admissions": {
      "name": "admissions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "elder_id": {
          "name": "elder_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "bed_id": {
          "name": "bed_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "admission_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "admitted_at": {
          "name": "admitted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "discharged_at": {
          "name": "discharged_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "admissions_organization_id_organizations_id_fk": {
          "name": "admissions_organization_id_organizations_id_fk",
          "tableFrom": "admissions",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "admissions_elder_id_elders_id_fk": {
          "name": "admissions_elder_id_elders_id_fk",
          "tableFrom": "admissions",
          "tableTo": "elders",
          "columnsFrom": [
            "elder_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "admissions_bed_id_beds_id_fk": {
          "name": "admissions_bed_id_beds_id_fk",
          "tableFrom": "admissions",
          "tableTo": "beds",
          "columnsFrom": [
            "bed_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.audit_logs": {
      "name": "audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "timestamp": {
          "name": "timestamp",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "actor_account_id": {
          "name": "actor_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "actor_email": {
          "name": "actor_email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "target_type": {
          "name": "target_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "target_id": {
          "name": "target_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "result": {
          "name": "result",
          "type": "audit_result",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "audit_logs_organization_id_organizations_id_fk": {
          "name": "audit_logs_organization_id_organizations_id_fk",
          "tableFrom": "audit_logs",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "audit_logs_actor_account_id_accounts_id_fk": {
          "name": "audit_logs_actor_account_id_accounts_id_fk",
          "tableFrom": "audit_logs",
          "tableTo": "accounts",
          "columnsFrom": [
            "actor_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.beds": {
      "name": "beds",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "room_id": {
          "name": "room_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "bed_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'available'"
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "beds_code_room_unique": {
          "name": "beds_code_room_unique",
          "columns": [
            {
              "expression": "room_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "beds_organization_id_organizations_id_fk": {
          "name": "beds_organization_id_organizations_id_fk",
          "tableFrom": "beds",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "beds_room_id_rooms_id_fk": {
          "name": "beds_room_id_rooms_id_fk",
          "tableFrom": "beds",
          "tableTo": "rooms",
          "columnsFrom": [
            "room_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.buildings": {
      "name": "buildings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "campus_id": {
          "name": "campus_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "buildings_organization_id_organizations_id_fk": {
          "name": "buildings_organization_id_organizations_id_fk",
          "tableFrom": "buildings",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "buildings_campus_id_campuses_id_fk": {
          "name": "buildings_campus_id_campuses_id_fk",
          "tableFrom": "buildings",
          "tableTo": "campuses",
          "columnsFrom": [
            "campus_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.campuses": {
      "name": "campuses",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "address": {
          "name": "address",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "campuses_organization_id_organizations_id_fk": {
          "name": "campuses_organization_id_organizations_id_fk",
          "tableFrom": "campuses",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.chronic_conditions": {
      "name": "chronic_conditions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "elder_id": {
          "name": "elder_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "chronic_condition_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "diagnosed_at": {
          "name": "diagnosed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "treatment_notes": {
          "name": "treatment_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "follow_up_notes": {
          "name": "follow_up_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "chronic_conditions_elder_status_lookup": {
          "name": "chronic_conditions_elder_status_lookup",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "elder_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "chronic_conditions_organization_id_organizations_id_fk": {
          "name": "chronic_conditions_organization_id_organizations_id_fk",
          "tableFrom": "chronic_conditions",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "chronic_conditions_elder_id_elders_id_fk": {
          "name": "chronic_conditions_elder_id_elders_id_fk",
          "tableFrom": "chronic_conditions",
          "tableTo": "elders",
          "columnsFrom": [
            "elder_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.elders": {
      "name": "elders",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "gender": {
          "name": "gender",
          "type": "gender",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "age": {
          "name": "age",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "care_level": {
          "name": "care_level",
          "type": "care_level",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "elder_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "primary_contact": {
          "name": "primary_contact",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "medical_notes": {
          "name": "medical_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "elders_organization_id_organizations_id_fk": {
          "name": "elders_organization_id_organizations_id_fk",
          "tableFrom": "elders",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.floors": {
      "name": "floors",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "building_id": {
          "name": "building_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "level": {
          "name": "level",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "floors_organization_id_organizations_id_fk": {
          "name": "floors_organization_id_organizations_id_fk",
          "tableFrom": "floors",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "floors_building_id_buildings_id_fk": {
          "name": "floors_building_id_buildings_id_fk",
          "tableFrom": "floors",
          "tableTo": "buildings",
          "columnsFrom": [
            "building_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.health_anomaly_reviews": {
      "name": "health_anomaly_reviews",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "elder_id": {
          "name": "elder_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "vital_record_id": {
          "name": "vital_record_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "severity": {
          "name": "severity",
          "type": "incident_severity",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "health_review_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "reviewed_by_account_id": {
          "name": "reviewed_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "reviewed_at": {
          "name": "reviewed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "resolution_notes": {
          "name": "resolution_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "health_anomaly_reviews_queue_lookup": {
          "name": "health_anomaly_reviews_queue_lookup",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "severity",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "health_anomaly_reviews_organization_id_organizations_id_fk": {
          "name": "health_anomaly_reviews_organization_id_organizations_id_fk",
          "tableFrom": "health_anomaly_reviews",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "health_anomaly_reviews_elder_id_elders_id_fk": {
          "name": "health_anomaly_reviews_elder_id_elders_id_fk",
          "tableFrom": "health_anomaly_reviews",
          "tableTo": "elders",
          "columnsFrom": [
            "elder_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "health_anomaly_reviews_vital_record_id_vital_records_id_fk": {
          "name": "health_anomaly_reviews_vital_record_id_vital_records_id_fk",
          "tableFrom": "health_anomaly_reviews",
          "tableTo": "vital_records",
          "columnsFrom": [
            "vital_record_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "health_anomaly_reviews_reviewed_by_account_id_accounts_id_fk": {
          "name": "health_anomaly_reviews_reviewed_by_account_id_accounts_id_fk",
          "tableFrom": "health_anomaly_reviews",
          "tableTo": "accounts",
          "columnsFrom": [
            "reviewed_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.health_profiles": {
      "name": "health_profiles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "elder_id": {
          "name": "elder_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "allergy_notes": {
          "name": "allergy_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "medical_history": {
          "name": "medical_history",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "medication_notes": {
          "name": "medication_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "care_restrictions": {
          "name": "care_restrictions",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "emergency_notes": {
          "name": "emergency_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "health_profiles_organization_elder_unique": {
          "name": "health_profiles_organization_elder_unique",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "elder_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "health_profiles_organization_id_organizations_id_fk": {
          "name": "health_profiles_organization_id_organizations_id_fk",
          "tableFrom": "health_profiles",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "health_profiles_elder_id_elders_id_fk": {
          "name": "health_profiles_elder_id_elders_id_fk",
          "tableFrom": "health_profiles",
          "tableTo": "elders",
          "columnsFrom": [
            "elder_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.join_requests": {
      "name": "join_requests",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "account_id": {
          "name": "account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "join_request_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "reviewed_by_account_id": {
          "name": "reviewed_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "reviewed_at": {
          "name": "reviewed_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "join_requests_account_id_accounts_id_fk": {
          "name": "join_requests_account_id_accounts_id_fk",
          "tableFrom": "join_requests",
          "tableTo": "accounts",
          "columnsFrom": [
            "account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "join_requests_organization_id_organizations_id_fk": {
          "name": "join_requests_organization_id_organizations_id_fk",
          "tableFrom": "join_requests",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "join_requests_reviewed_by_account_id_accounts_id_fk": {
          "name": "join_requests_reviewed_by_account_id_accounts_id_fk",
          "tableFrom": "join_requests",
          "tableTo": "accounts",
          "columnsFrom": [
            "reviewed_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.memberships": {
      "name": "memberships",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "account_id": {
          "name": "account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role_id": {
          "name": "role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "membership_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "memberships_account_organization_unique": {
          "name": "memberships_account_organization_unique",
          "columns": [
            {
              "expression": "account_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "memberships_account_id_accounts_id_fk": {
          "name": "memberships_account_id_accounts_id_fk",
          "tableFrom": "memberships",
          "tableTo": "accounts",
          "columnsFrom": [
            "account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "memberships_organization_id_organizations_id_fk": {
          "name": "memberships_organization_id_organizations_id_fk",
          "tableFrom": "memberships",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "memberships_role_id_roles_id_fk": {
          "name": "memberships_role_id_roles_id_fk",
          "tableFrom": "memberships",
          "tableTo": "roles",
          "columnsFrom": [
            "role_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organization_invitations": {
      "name": "organization_invitations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role_id": {
          "name": "role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "token": {
          "name": "token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_by_account_id": {
          "name": "created_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "accepted_by_account_id": {
          "name": "accepted_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "accepted_at": {
          "name": "accepted_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "organization_invitations_token_unique": {
          "name": "organization_invitations_token_unique",
          "columns": [
            {
              "expression": "token",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "organization_invitations_organization_id_organizations_id_fk": {
          "name": "organization_invitations_organization_id_organizations_id_fk",
          "tableFrom": "organization_invitations",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "organization_invitations_role_id_roles_id_fk": {
          "name": "organization_invitations_role_id_roles_id_fk",
          "tableFrom": "organization_invitations",
          "tableTo": "roles",
          "columnsFrom": [
            "role_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "organization_invitations_created_by_account_id_accounts_id_fk": {
          "name": "organization_invitations_created_by_account_id_accounts_id_fk",
          "tableFrom": "organization_invitations",
          "tableTo": "accounts",
          "columnsFrom": [
            "created_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "organization_invitations_accepted_by_account_id_accounts_id_fk": {
          "name": "organization_invitations_accepted_by_account_id_accounts_id_fk",
          "tableFrom": "organization_invitations",
          "tableTo": "accounts",
          "columnsFrom": [
            "accepted_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organizations": {
      "name": "organizations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "organization_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "registration_enabled": {
          "name": "registration_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "oidc_enabled": {
          "name": "oidc_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "oidc_issuer_url": {
          "name": "oidc_issuer_url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_client_id": {
          "name": "oidc_client_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_client_secret": {
          "name": "oidc_client_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_scopes": {
          "name": "oidc_scopes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'openid profile email'"
        },
        "oidc_redirect_uri": {
          "name": "oidc_redirect_uri",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_avatar_claim": {
          "name": "oidc_avatar_claim",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'picture'"
        },
        "oidc_auto_provision": {
          "name": "oidc_auto_provision",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "organizations_slug_unique": {
          "name": "organizations_slug_unique",
          "columns": [
            {
              "expression": "slug",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.permissions": {
      "name": "permissions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.role_permissions": {
      "name": "role_permissions",
      "schema": "",
      "columns": {
        "role_id": {
          "name": "role_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "permission_id": {
          "name": "permission_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "role_permissions_role_id_roles_id_fk": {
          "name": "role_permissions_role_id_roles_id_fk",
          "tableFrom": "role_permissions",
          "tableTo": "roles",
          "columnsFrom": [
            "role_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "role_permissions_permission_id_permissions_id_fk": {
          "name": "role_permissions_permission_id_permissions_id_fk",
          "tableFrom": "role_permissions",
          "tableTo": "permissions",
          "columnsFrom": [
            "permission_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "role_permissions_role_id_permission_id_pk": {
          "name": "role_permissions_role_id_permission_id_pk",
          "columns": [
            "role_id",
            "permission_id"
          ]
        }
      },
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.roles": {
      "name": "roles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "scope": {
          "name": "scope",
          "type": "role_scope",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_system": {
          "name": "is_system",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "roles_key_organization_unique": {
          "name": "roles_key_organization_unique",
          "columns": [
            {
              "expression": "key",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "roles_organization_id_organizations_id_fk": {
          "name": "roles_organization_id_organizations_id_fk",
          "tableFrom": "roles",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.rooms": {
      "name": "rooms",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "floor_id": {
          "name": "floor_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "capacity": {
          "name": "capacity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "status": {
          "name": "status",
          "type": "organization_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "rooms_code_organization_unique": {
          "name": "rooms_code_organization_unique",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "rooms_organization_id_organizations_id_fk": {
          "name": "rooms_organization_id_organizations_id_fk",
          "tableFrom": "rooms",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "rooms_floor_id_floors_id_fk": {
          "name": "rooms_floor_id_floors_id_fk",
          "tableFrom": "rooms",
          "tableTo": "floors",
          "columnsFrom": [
            "floor_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sessions": {
      "name": "sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "account_id": {
          "name": "account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "active_organization_id": {
          "name": "active_organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sessions_account_id_accounts_id_fk": {
          "name": "sessions_account_id_accounts_id_fk",
          "tableFrom": "sessions",
          "tableTo": "accounts",
          "columnsFrom": [
            "account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "sessions_active_organization_id_organizations_id_fk": {
          "name": "sessions_active_organization_id_organizations_id_fk",
          "tableFrom": "sessions",
          "tableTo": "organizations",
          "columnsFrom": [
            "active_organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.system_incidents": {
      "name": "system_incidents",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "severity": {
          "name": "severity",
          "type": "incident_severity",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "incident_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'open'"
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "source": {
          "name": "source",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "acknowledged_by_account_id": {
          "name": "acknowledged_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "acknowledged_at": {
          "name": "acknowledged_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "resolved_by_account_id": {
          "name": "resolved_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "system_incidents_organization_id_organizations_id_fk": {
          "name": "system_incidents_organization_id_organizations_id_fk",
          "tableFrom": "system_incidents",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "system_incidents_acknowledged_by_account_id_accounts_id_fk": {
          "name": "system_incidents_acknowledged_by_account_id_accounts_id_fk",
          "tableFrom": "system_incidents",
          "tableTo": "accounts",
          "columnsFrom": [
            "acknowledged_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "system_incidents_resolved_by_account_id_accounts_id_fk": {
          "name": "system_incidents_resolved_by_account_id_accounts_id_fk",
          "tableFrom": "system_incidents",
          "tableTo": "accounts",
          "columnsFrom": [
            "resolved_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.system_settings": {
      "name": "system_settings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true,
          "default": "'global'"
        },
        "registration_enabled": {
          "name": "registration_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "oidc_enabled": {
          "name": "oidc_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "oidc_issuer_url": {
          "name": "oidc_issuer_url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_client_id": {
          "name": "oidc_client_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_client_secret": {
          "name": "oidc_client_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_scopes": {
          "name": "oidc_scopes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'openid profile email'"
        },
        "oidc_redirect_uri": {
          "name": "oidc_redirect_uri",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "oidc_avatar_claim": {
          "name": "oidc_avatar_claim",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'picture'"
        },
        "oidc_auto_provision": {
          "name": "oidc_auto_provision",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.vital_records": {
      "name": "vital_records",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "organization_id": {
          "name": "organization_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "elder_id": {
          "name": "elder_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "recorded_at": {
          "name": "recorded_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true
        },
        "source": {
          "name": "source",
          "type": "vital_record_source",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'manual'"
        },
        "systolic_bp": {
          "name": "systolic_bp",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "diastolic_bp": {
          "name": "diastolic_bp",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "heart_rate": {
          "name": "heart_rate",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "temperature_tenths": {
          "name": "temperature_tenths",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "spo2": {
          "name": "spo2",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "blood_glucose_tenths": {
          "name": "blood_glucose_tenths",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "weight_tenths": {
          "name": "weight_tenths",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "''"
        },
        "created_by_account_id": {
          "name": "created_by_account_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp with time zone",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "vital_records_recent_lookup": {
          "name": "vital_records_recent_lookup",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "elder_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "recorded_at",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "vital_records_organization_id_organizations_id_fk": {
          "name": "vital_records_organization_id_organizations_id_fk",
          "tableFrom": "vital_records",
          "tableTo": "organizations",
          "columnsFrom": [
            "organization_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "vital_records_elder_id_elders_id_fk": {
          "name": "vital_records_elder_id_elders_id_fk",
          "tableFrom": "vital_records",
          "tableTo": "elders",
          "columnsFrom": [
            "elder_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "vital_records_created_by_account_id_accounts_id_fk": {
          "name": "vital_records_created_by_account_id_accounts_id_fk",
          "tableFrom": "vital_records",
          "tableTo": "accounts",
          "columnsFrom": [
            "created_by_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {
    "public.account_status": {
      "name": "account_status",
      "schema": "public",
      "values": [
        "active",
        "disabled",
        "pending"
      ]
    },
    "public.admission_status": {
      "name": "admission_status",
      "schema": "public",
      "values": [
        "active",
        "transferred",
        "discharged"
      ]
    },
    "public.audit_result": {
      "name": "audit_result",
      "schema": "public",
      "values": [
        "success",
        "denied",
        "failure"
      ]
    },
    "public.bed_status": {
      "name": "bed_status",
      "schema": "public",
      "values": [
        "available",
        "occupied",
        "maintenance",
        "disabled"
      ]
    },
    "public.care_level": {
      "name": "care_level",
      "schema": "public",
      "values": [
        "self-care",
        "semi-assisted",
        "assisted",
        "intensive"
      ]
    },
    "public.chronic_condition_status": {
      "name": "chronic_condition_status",
      "schema": "public",
      "values": [
        "active",
        "controlled",
        "resolved"
      ]
    },
    "public.elder_status": {
      "name": "elder_status",
      "schema": "public",
      "values": [
        "active",
        "pending",
        "discharged"
      ]
    },
    "public.gender": {
      "name": "gender",
      "schema": "public",
      "values": [
        "male",
        "female",
        "other"
      ]
    },
    "public.health_review_status": {
      "name": "health_review_status",
      "schema": "public",
      "values": [
        "pending",
        "reviewed",
        "resolved"
      ]
    },
    "public.incident_severity": {
      "name": "incident_severity",
      "schema": "public",
      "values": [
        "info",
        "warning",
        "critical"
      ]
    },
    "public.incident_status": {
      "name": "incident_status",
      "schema": "public",
      "values": [
        "open",
        "acknowledged",
        "resolved",
        "closed"
      ]
    },
    "public.join_request_status": {
      "name": "join_request_status",
      "schema": "public",
      "values": [
        "pending",
        "approved",
        "rejected"
      ]
    },
    "public.membership_status": {
      "name": "membership_status",
      "schema": "public",
      "values": [
        "active",
        "disabled",
        "pending"
      ]
    },
    "public.organization_status": {
      "name": "organization_status",
      "schema": "public",
      "values": [
        "active",
        "disabled"
      ]
    },
    "public.role_scope": {
      "name": "role_scope",
      "schema": "public",
      "values": [
        "platform",
        "organization"
      ]
    },
    "public.vital_record_source": {
      "name": "vital_record_source",
      "schema": "public",
      "values": [
        "manual",
        "device",
        "import"
      ]
    }
  },
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}