Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-3767

Merge the subscription and contracts data models into one

XMLWordPrintable

    • Consolidate subscription and contracts data models
    • False
    • Hide

      None

      Show
      None
    • False
    • In Progress
    • subs-swatch
    • 60% To Do, 10% In Progress, 30% Done

      Design Document: https://docs.google.com/document/d/1T47CHzl2G5Tye5b7gBCz66q1Up-M-JbgVYmHiHzNdwU/edit?usp=sharing

      At the moment, we’re duplicating the same data in the subscriptions and the contracts tables:

      The design changes aim to consolidate this structure to avoid having large amounts of data duplicated into two different tables.

      The target is to only have the subscriptions table as shown in:

      Advantages of Consolidation

      Architecture Simplification:

      • Eliminates duplication: Currently there's redundant data between subscription_measurements and contract_metrics
      • Unified data model: Single location for metrics and capacities reduces complexity
      • Simplified maintenance: Fewer entities = fewer failure points

      Performance Improvements:

      • Fewer JOINs: Coverage queries won't need to join multiple tables
      • More efficient caching: Single data model to cache
      • Simplified synchronization: Currently there's complex logic to keep contracts and subscriptions in sync

      Data Consistency:

      • Single source of truth: Capacity data will be in one place
      • Lower inconsistency risk: No desynchronization between contract_metrics and subscription_measurements

      Implementation Plan

      1.- Stop using the SubscriptionId and only use the SubscriptionNumber. This will be done as part of SWATCH-2416.
      2.- Migrate contract_metrics data to subscription_measurements
      3.- Remove ContractEntity and migrate vendor_product_code

        1. mermaid-diagram-2025-07-04-141700.png
          367 kB
          Jose Carvajal Hilario
        2. mermaid-diagram-2025-07-04-142741.png
          269 kB
          Jose Carvajal Hilario

              jcarvaja@redhat.com Jose Carvajal Hilario
              jcarvaja@redhat.com Jose Carvajal Hilario
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: