{
  "tables": [
    {
      "name": "products",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "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
        }
      ],
      "position": {
        "x": -80.14223755207979,
        "y": 661.9011892971798
      },
      "id": "products"
    },
    {
      "name": "customers",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "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": "text",
          "nullable": false,
          "default": "'active'"
        }
      ],
      "position": {
        "x": 488.3680460692574,
        "y": 184.99238013113856
      },
      "id": "customers"
    },
    {
      "name": "orders",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "name": "customer_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "customers",
            "targetColumn": "id"
          }
        },
        {
          "name": "ordered_at",
          "type": "timestamptz",
          "nullable": false,
          "default": "now()"
        },
        {
          "name": "status",
          "type": "text",
          "nullable": false,
          "default": "'pending'"
        },
        {
          "name": "total_cents",
          "type": "integer",
          "nullable": false
        }
      ],
      "position": {
        "x": 1123.5788624410884,
        "y": 34.91618144252444
      },
      "id": "orders"
    },
    {
      "name": "order_items",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "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
        }
      ],
      "position": {
        "x": 829.9847602622774,
        "y": 453.4620244518826
      },
      "id": "order_items"
    },
    {
      "name": "warehouses",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "name": "code",
          "type": "text",
          "nullable": false,
          "unique": true
        },
        {
          "name": "name",
          "type": "text",
          "nullable": false
        },
        {
          "name": "location",
          "type": "text",
          "nullable": false
        },
        {
          "name": "active",
          "type": "boolean",
          "nullable": false,
          "default": true
        }
      ],
      "position": {
        "x": -130.16763711495116,
        "y": 198.22072860460358
      },
      "id": "warehouses"
    },
    {
      "name": "stock_levels",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "name": "product_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "products",
            "targetColumn": "id"
          }
        },
        {
          "name": "warehouse_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "warehouses",
            "targetColumn": "id"
          }
        },
        {
          "name": "quantity_on_hand",
          "type": "integer",
          "nullable": false,
          "default": 0
        },
        {
          "name": "reorder_threshold",
          "type": "integer",
          "nullable": false,
          "default": 0
        },
        {
          "name": "updated_at",
          "type": "timestamptz",
          "nullable": false,
          "default": "now()"
        }
      ],
      "indexes": [
        {
          "name": "stock_levels_product_warehouse_uidx",
          "columns": [
            "product_id",
            "warehouse_id"
          ],
          "unique": true
        }
      ],
      "position": {
        "x": 278.26136790519746,
        "y": 430.0050799125746
      },
      "id": "stock_levels"
    },
    {
      "name": "stock_movements",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "name": "product_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "products",
            "targetColumn": "id"
          }
        },
        {
          "name": "warehouse_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "warehouses",
            "targetColumn": "id"
          }
        },
        {
          "name": "movement_type",
          "type": "text",
          "nullable": false,
          "default": "'adjustment'"
        },
        {
          "name": "quantity_delta",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "reference",
          "type": "text",
          "nullable": true
        },
        {
          "name": "moved_at",
          "type": "timestamptz",
          "nullable": false,
          "default": "now()"
        }
      ],
      "position": {
        "x": -405.53085086401217,
        "y": 530.055879038316
      },
      "id": "stock_movements"
    },
    {
      "name": "stock_reservations",
      "columns": [
        {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "nullable": false,
          "default": "gen_random_uuid()"
        },
        {
          "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": "warehouse_id",
          "type": "uuid",
          "nullable": false,
          "foreignKey": {
            "targetTable": "warehouses",
            "targetColumn": "id"
          }
        },
        {
          "name": "reserved_quantity",
          "type": "integer",
          "nullable": false
        },
        {
          "name": "status",
          "type": "text",
          "nullable": false,
          "default": "'active'"
        },
        {
          "name": "reserved_at",
          "type": "timestamptz",
          "nullable": false,
          "default": "now()"
        }
      ],
      "position": {
        "x": 201.3322390888604,
        "y": 6.456696946930002
      },
      "id": "stock_reservations"
    }
  ],
  "relationships": [],
  "title": "Shop Test Model",
  "storagePath": "/HomeLab/DBModelView/shop-test-db.dbmv.json"
}