cubes:
  - name: product_stock_component
    sql_table: inventory_v2.product_stock_component
    data_source: default

    joins:
      - name: product
        sql: "{CUBE}.`productId` = {product.id}"
        relationship: many_to_one

    dimensions:
      - name: id
        sql: id
        type: number
        primary_key: true

      - name: sku
        sql: sku
        type: string

      - name: createdat
        sql: "{CUBE}.`createdAt`"
        type: time

      - name: updatedat
        sql: "{CUBE}.`updatedAt`"
        type: time

    measures:
      - name: count
        type: count

      - name: quantity
        sql: quantity
        type: sum

    pre_aggregations:
      # Pre-aggregation definitions go here.
      # Learn more in the documentation: https://cube.dev/docs/caching/pre-aggregations/getting-started

