[
    {
        "name": "User",
        "type": "record",
        "logicalType": "Aggregate",
        "fields": [
            {"name": "uuid", "type": "string", "default": "-1"},
            {"name": "username", "type": "string"},
            {"name": "phone", "type": "string"}

        ],
        "indexes": [
          "uuid",
          "phone"
        ],
        "relations": [
          { "name": "subscription", "to": "Subscription", "count": "many", "from_fields": "uuid", "to_fields": "user_uuid" }
        ]
    },
    {
        "name": "Book",
        "type": "record",
        "logicalType": "Aggregate",
        "fields": [
            {"name": "uuid", "type": "string", "default": "-1"},
            {"name": "book_name", "type": "string"},
            {"name": "author", "type": "string"}
        ],
        "indexes": ["uuid"],
        "relations": [
          { "name": "subscription", "to": "Subscription", "count": "many", "from_fields": "uuid", "to_fields": "book_uuid" }
        ]
    },
    {
    "name": "Subscription",
    "type": "record",
    "logicalType": "Aggregate",
    "fields": [
        {"name": "uuid", "type": "string", "default": "-1"},
        {"name": "user_uuid", "type": "string"},
        {"name": "book_uuid", "type": "string"}
    ],
    "indexes": [
      {"name":"pkey", "parts": ["uuid", "user_uuid"]},
      "user_uuid",
      "book_uuid",
      "uuid"
    ],
    "relations": [
      { "name": "user", "to": "User", "count": "one", "from_fields": "user_uuid", "to_fields": "uuid" },
      { "name": "book", "to": "Book", "count": "one", "from_fields": "book_uuid", "to_fields": "uuid" }
    ]
    }
]