{
  "title": "My Test Schema",
  "storagePath": "/HomeLab/DBModelView/my-test-schema.dbmv.json",
  "tables": [
    {
      "id": "car",
      "name": "Car",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "uuid_generate_v4()"
        },
        {
          "name": "make"
        }
      ],
      "indexes": [],
      "position": {
        "x": -294.3862012316283,
        "y": -177.2892416104948
      },
      "extensions": {
        "color": "amber"
      },
      "constraints": [],
      "primaryKey": {
        "columns": [
          "id"
        ]
      }
    },
    {
      "id": "users",
      "name": "users",
      "description": "Registered platform members with authentication credentials and profile metadata.",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "uuid_generate_v4()"
        },
        {
          "name": "email",
          "type": "text",
          "nullable": false,
          "unique": true
        },
        {
          "name": "display_name",
          "type": "text",
          "nullable": false
        },
        {
          "name": "created_at",
          "type": "timestamptz",
          "nullable": false,
          "default": "now()"
        },
        {
          "name": "status",
          "type": "user_status",
          "nullable": false,
          "default": "'active'::user_status"
        }
      ],
      "indexes": [
        {
          "name": "users_email_idx",
          "unique": true,
          "columns": [
            "email"
          ]
        },
        {
          "name": "users_status_created_at_idx",
          "columns": [
            "status",
            "created_at"
          ],
          "method": "btree"
        }
      ],
      "position": {
        "x": -431.38190736637443,
        "y": 223.23166715840568
      }
    },
    {
      "id": "products",
      "name": "products",
      "description": "Catalog entries that can appear on customer orders.",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "uuid_generate_v4()"
        },
        {
          "name": "sku",
          "type": "text",
          "nullable": false,
          "unique": true
        },
        {
          "name": "name",
          "type": "text",
          "nullable": false
        },
        {
          "name": "price_cents",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "active",
          "type": "boolean",
          "nullable": false,
          "default": "true"
        }
      ],
      "indexes": [
        {
          "name": "products_active_idx",
          "columns": [
            "active"
          ],
          "method": "btree"
        }
      ],
      "position": {
        "x": 261.65243850161784,
        "y": -173.3054100448862
      }
    },
    {
      "id": "orders",
      "name": "orders",
      "description": "Order headers capturing who placed the order and its fulfilment status.",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "uuid_generate_v4()"
        },
        {
          "name": "user_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "users",
            "targetColumn": "id"
          }
        },
        {
          "name": "ordered_at",
          "type": "timestamptz",
          "nullable": false,
          "default": "now()"
        },
        {
          "name": "status",
          "type": "order_status",
          "nullable": false,
          "default": "'pending'::order_status"
        },
        {
          "name": "total_cents",
          "type": "integer",
          "nullable": false
        }
      ],
      "indexes": [
        {
          "name": "orders_user_id_idx",
          "columns": [
            "user_id"
          ],
          "method": "btree"
        },
        {
          "name": "orders_status_idx",
          "columns": [
            "status"
          ],
          "method": "btree"
        }
      ],
      "position": {
        "x": 155.21333921345612,
        "y": 648.4589980752919
      }
    },
    {
      "id": "order_items",
      "name": "order_items",
      "description": "Line items associated with an order, connecting products and quantities.",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "uuid_generate_v4()"
        },
        {
          "name": "order_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "orders",
            "targetColumn": "id"
          }
        },
        {
          "name": "product_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "products",
            "targetColumn": "id"
          }
        },
        {
          "name": "quantity",
          "type": "integer",
          "nullable": false,
          "default": 1
        },
        {
          "name": "unit_price_cents",
          "type": "integer",
          "nullable": false
        }
      ],
      "indexes": [
        {
          "name": "order_items_order_id_idx",
          "columns": [
            "order_id"
          ],
          "method": "btree"
        },
        {
          "name": "order_items_product_id_idx",
          "columns": [
            "product_id"
          ],
          "method": "btree"
        }
      ],
      "position": {
        "x": 761.8225884610504,
        "y": 240.56113664477778
      }
    }
  ],
  "relationships": [
    {
      "type": "foreignKey",
      "sourceTable": "orders",
      "targetTable": "users"
    },
    {
      "type": "foreignKey",
      "sourceTable": "order_items",
      "targetTable": "orders"
    },
    {
      "type": "foreignKey",
      "sourceTable": "order_items",
      "targetTable": "products"
    }
  ]
}