Skip to content

Instantly share code, notes, and snippets.

@abidkhan484
Created January 13, 2026 10:38
Show Gist options
  • Select an option

  • Save abidkhan484/7df3b477d4f70f9729298812df5efaed to your computer and use it in GitHub Desktop.

Select an option

Save abidkhan484/7df3b477d4f70f9729298812df5efaed to your computer and use it in GitHub Desktop.
erDiagram
    MERCHANT ||--o{ PROGRAM : "configures"

    PROGRAM ||--o{ PROGRAM_CUSTOMER_ACCOUNT : "has"
    PROGRAM ||--o{ PROGRAM_ORDER_FULFILLMENT : "has"
    PROGRAM ||--o{ PROGRAM_ORDER_DISCOUNT : "has"
    PROGRAM_ORDER_FULFILLMENT ||--o{ RULE_TARGET : "includes_or_excludes"
    PROGRAM_ORDER_DISCOUNT ||--o{ RULE_TARGET : "includes_or_excludes"

    PROGRAM {
        int id PK
        int merchant_id FK 
        string name
        string type "customer_account | order_fulfillment | order_discount"
        boolean is_active
    }

    PROGRAM_CUSTOMER_ACCOUNT {
        int id PK
        int program_id FK 
        string name "sign_up | birthday | gender"
        int point
    }

    PROGRAM_ORDER_FULFILLMENT {
        int id PK
        int program_id FK
        string earning_type "fixed | logical"
        int point
        int order_value
        string currency
        int minimum_order_value
        boolean is_include_exclude_configured
    }

    RULE_TARGET {
        int id PK
        int program_order_fulfillment_id FK
        string target_type "include | exclude"
        string entity_type "product | collection"
        string shopify_entity_id
    }

    PROGRAM_ORDER_DISCOUNT {
        int id PK
        int program_id FK
        string redeem_type "percentage | logical"
        int point
        int dicounted_amount
        int min_points_to_redeem
        int min_points_to_redeem_per_order
        int min_order_value
        int discount_capped_at
        boolean is_include_exclude_configured
    }
    
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment