{
  "format": "erd-studio",
  "file_version": 1,
  "exported_at": "2026-10-08T00:00:00.000Z",
  "name": "Order system example",
  "document": {
    "schema_version": 1,
    "settings": {
      "target_database": "postgresql",
      "table_simplification": "default",
      "show_cardinality": true,
      "show_crow_foot": false,
      "new_table": {
        "primary_key": {
          "enabled": true,
          "column_name": "id",
          "data_type": "INTEGER"
        }
      },
      "new_column": {
        "data_type": "TEXT",
        "nullable": true
      },
      "naming": {
        "table_pattern": "table_{n}",
        "column_pattern": "column_{n}",
        "primary_key_constraint_pattern": "pk_{table}",
        "style": "preserve"
      }
    },
    "tables": [
      {
        "id": "order-example-customers",
        "name": "customers",
        "description": "",
        "position": {
          "x": 80,
          "y": 80
        },
        "columns": [
          {
            "id": "order-example-customers-id",
            "name": "id",
            "data_type": "INTEGER",
            "nullable": false,
            "default": {
              "kind": "none"
            }
          },
          {
            "id": "order-example-customers-email",
            "name": "email",
            "data_type": "TEXT",
            "nullable": false,
            "default": {
              "kind": "none"
            }
          }
        ],
        "constraints": [
          {
            "id": "order-example-customers-pk",
            "name": "customers_pkey",
            "name_mode": "custom",
            "kind": "primary_key",
            "column_ids": ["order-example-customers-id"]
          },
          {
            "id": "order-example-customers-email-unique",
            "name": "customers_email_key",
            "name_mode": "custom",
            "kind": "unique",
            "column_ids": ["order-example-customers-email"]
          }
        ]
      },
      {
        "id": "order-example-orders",
        "name": "orders",
        "description": "",
        "position": {
          "x": 440,
          "y": 80
        },
        "columns": [
          {
            "id": "order-example-orders-id",
            "name": "id",
            "data_type": "INTEGER",
            "nullable": false,
            "default": {
              "kind": "none"
            }
          },
          {
            "id": "order-example-orders-customer-id",
            "name": "customer_id",
            "data_type": "INTEGER",
            "nullable": false,
            "default": {
              "kind": "none"
            }
          },
          {
            "id": "order-example-orders-total",
            "name": "total",
            "data_type": "NUMERIC",
            "nullable": false,
            "default": {
              "kind": "none"
            }
          },
          {
            "id": "order-example-orders-created-at",
            "name": "created_at",
            "data_type": "TIMESTAMPTZ",
            "nullable": false,
            "default": {
              "kind": "current_timestamp"
            }
          }
        ],
        "constraints": [
          {
            "id": "order-example-orders-pk",
            "name": "orders_pkey",
            "name_mode": "custom",
            "kind": "primary_key",
            "column_ids": ["order-example-orders-id"]
          },
          {
            "id": "order-example-orders-total-nonnegative",
            "name": "orders_total_check",
            "name_mode": "custom",
            "kind": "check",
            "column_ids": ["order-example-orders-total"],
            "check": {
              "column_id": "order-example-orders-total",
              "operator": ">=",
              "value": "0"
            }
          }
        ]
      }
    ],
    "relationships": [
      {
        "id": "order-example-orders-customer",
        "foreign_key": {
          "table_id": "order-example-orders",
          "column_id": "order-example-orders-customer-id"
        },
        "referenced_key": {
          "table_id": "order-example-customers",
          "column_id": "order-example-customers-id"
        }
      }
    ]
  }
}
