githubEdit

circle-rightInventoryItem Data Field

Migration guide for the breaking change from inventoryJSONData to the unified data field

Audience: Programmer

Overview

This guide covers a breaking change in the pyck GraphQL API where the inventoryJSONData field has been removed from the InventoryItem type. This field has been replaced with the unified data field that is now available across all entity types through the shared DataMixin.

What Changed

Before: InventoryItem had a separate inventoryJSONData field for storing custom JSON data.

type InventoryItem {
  id: ID!
  sku: String!
  inventoryJSONData: Map  # Removed
  # ... other fields
}

After: InventoryItem uses the unified data field from the WithCustomData interface.

type InventoryItem implements WithCustomData {
  id: ID!
  sku: String!
  data: Map
  # ... other fields
}

Breaking Changes

  1. Field Removed: The inventoryJSONData field no longer exists on InventoryItem

  2. Database Migration: The inventory_json_data column has been removed from the items table

  3. Data Preserved: All data previously stored in inventoryJSONData has been migrated to the data field

Migration Steps

Step 1: Update GraphQL Queries

Replace all occurrences of inventoryJSONData with data in your queries.

Before:

After:

Step 2: Update Mutations

Update create and update mutations to use data instead of inventoryJSONData.

Before:

After:

Step 3: Update Filter Queries

Update where clauses that filter on JSON data fields.

Before:

After:

Step 4: Update Client Code

Update your client code to use the new field name.

Before (JavaScript):

After (JavaScript):

Complete Migration Examples

Example 1: Query with Custom Data

Before:

After:

Example 2: Create Item with Custom Data

Before:

After:

Example 3: Update Item Custom Data

Before:

After:

Benefits of This Change

  1. Consistency: All entity types now use the same data field through the WithCustomData interface

  2. Simplified Schema: Reduces duplication by using shared mixins across entity types

  3. Unified Filtering: Consistent filter names (dataHasKey, dataContains, etc.) across all entity types

  4. Better Type System: Leverages GraphQL interfaces for shared behavior

Filter Input Changes

The following filter fields have been renamed for consistency:

Old Field Name
New Field Name

inventoryJSONData

data

inventoryJSONDataHasKey

dataHasKey

inventoryJSONDataIn

dataIn

inventoryJSONDataContains

dataContains

Troubleshooting

Error: Cannot query field "inventoryJSONData" on type "InventoryItem"

This error indicates you are still using the old field name. Update your query to use data:

Error: Field "inventoryJSONDataHasKey" is not defined

Update your where clause to use the new filter field names:

Last updated

Was this helpful?