---
title: Database changes for inventory service
slug: commerce-connect-14/docs/database-changes-for-inventory-service
docTags: 
createdAt: 2026-07-23T10:25:33.704Z
---

## Access inventory information 

Direct database access usually is not a recommended practice. Instead, you should access this information either through the [Optimizely Service API](docId\:dvggu2_Y41Ee6NxmqNtAE) or the inventory APIs.

The database schema is considered an internal artifact of the system. Database schema changes may occur at any release without affecting the semantic versioning scheme. This means that a breaking change, such as changing tables or table names in the database schema, does not result in a major version update of Commerce Connect.

See [Inventory requests](docId\:n4QiHrjZDBv_I5ueBkA3g) for information about accessing warehouse inventory information.

## Database schema changes

The modifications to the database schema involve migration of information from the old `WarehouseInventory` table to the new InventoryService table. If you have reporting running against the old `WarehouseInventory` table, this table will not receive any new or updated information, but the existing information remains.

**Commerce Connect 11 and higher**

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/3hadmF51CatN8LGMM9Q7x-20260723-094604.png)

**Commerce Connect 10 and lower**

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/s9Crp8vwqL5hBrfpqSKcX-20260723-094604.png)

### Migration script

When you migrate data between the systems, the following script is executed.

**Commerce Connect 11 and higher**

```csharp
insert into [dbo].[InventoryService]
      (
        [CatalogEntryCode],
        [WarehouseCode],
        [IsTracked],
        [PurchaseAvailableQuantity],
        [PreorderAvailableQuantity],
        [BackorderAvailableQuantity],
        [PurchaseRequestedQuantity],
        [PreorderRequestedQuantity],
        [BackorderRequestedQuantity],
        [PurchaseAvailableUtc],
        [PreorderAvailableUtc],
        [BackorderAvailableUtc],
        [AdditionalQuantity],
        [ReorderMinQuantity]
      ) 
    select
      wi.[CatalogEntryCode],
      wi.[WarehouseCode],
      cast(case wi.[InventoryStatus] when 1 then 1 else 0 end as bit) as [IsTracked],
      wi.[InStockQuantity] - wi.[ReservedQuantity] as [PurchaseAvailableQuantity],
      wi.[PreorderQuantity] as [PreorderAvailableQuantity],
      wi.[BackorderQuantity] as [BackorderAvailableQuantity],
      0 as [PurchaseRequestedQuantity],
      0 as [PreorderRequestedQuantity],
      0 as [BackorderRequestedQuantity],
      ce.[StartDate] as [PurchaseAvailableDate],
      case
        when wi.[AllowPreorder] = 1 and wi.[PreorderAvailabilityDate] < ce.[StartDate] then wi.[PreorderAvailabilityDate]
      else ce.[StartDate]
    end as [PreorderAvailableUtc],
      wi.[BackorderAvailabilityDate] as [BackorderAvailableUtc],
      wi.[ReservedQuantity] as [AdditionalQuantity],
      wi.[ReorderMinQuantity]
    from [dbo].[WarehouseInventory] wi
    join [dbo].[CatalogEntry] ce on wi.[CatalogEntryCode] = ce.[Code]
```

**Commerce Connect 10 and lower**

```csharp
insert into [dbo].[InventoryService]
     (
        [ApplicationId],
        [CatalogEntryCode],
        [WarehouseCode],
        [IsTracked],
        [PurchaseAvailableQuantity],
        [PreorderAvailableQuantity],
        [BackorderAvailableQuantity],
        [PurchaseRequestedQuantity],
        [PreorderRequestedQuantity],
        [BackorderRequestedQuantity],
        [PurchaseAvailableUtc],
        [PreorderAvailableUtc],
        [BackorderAvailableUtc],
        [AdditionalQuantity],
        [ReorderMinQuantity]
      )
    select
      wi.[ApplicationId],
      wi.[CatalogEntryCode],
      wi.[WarehouseCode],
      cast(case wi.[InventoryStatus] when 1 then 1 else 0 end as bit) as [IsTracked],
      wi.[InStockQuantity] - wi.[ReservedQuantity] as [PurchaseAvailableQuantity],
      wi.[PreorderQuantity] as [PreorderAvailableQuantity],
      wi.[BackorderQuantity] as [BackorderAvailableQuantity],
      0 as [PurchaseRequestedQuantity],
      0 as [PreorderRequestedQuantity],
      0 as [BackorderRequestedQuantity],
      ce.[StartDate] as [PurchaseAvailableDate],
      case
        when wi.[AllowPreorder] = 1 and wi.[PreorderAvailabilityDate] < ce.[StartDate] then 
        wi.[PreorderAvailabilityDate]
      else ce.[StartDate]
    end as [PreorderAvailableUtc],
      wi.[BackorderAvailabilityDate] as [BackorderAvailableUtc],
      wi.[ReservedQuantity] as [AdditionalQuantity],
      wi.[ReorderMinQuantity]
    from [dbo].[WarehouseInventory] wi
    join [dbo].[CatalogEntry] ce on wi.[ApplicationId] = ce.[ApplicationId] and wi.[CatalogEntryCode] = ce.[Code]
```
