{
  "version": "5",
  "dialect": "mysql",
  "id": "1e1556d8-3ebb-4f99-bd97-ee4397b9df3b",
  "prevId": "99d23350-1958-4a12-aaa8-98d5e0540e35",
  "tables": {
    "accounts": {
      "name": "accounts",
      "columns": {
        "userId": {
          "name": "userId",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "provider": {
          "name": "provider",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "providerAccountId": {
          "name": "providerAccountId",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "refresh_token": {
          "name": "refresh_token",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "access_token": {
          "name": "access_token",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "token_type": {
          "name": "token_type",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "scope": {
          "name": "scope",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "id_token": {
          "name": "id_token",
          "type": "varchar(2048)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "session_state": {
          "name": "session_state",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "accounts_userId_users_id_fk": {
          "name": "accounts_userId_users_id_fk",
          "tableFrom": "accounts",
          "tableTo": "users",
          "columnsFrom": [
            "userId"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "accounts_provider_providerAccountId_pk": {
          "name": "accounts_provider_providerAccountId_pk",
          "columns": [
            "provider",
            "providerAccountId"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "affiliate_commissions": {
      "name": "affiliate_commissions",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "affiliate_id": {
          "name": "affiliate_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_id": {
          "name": "order_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "customer_email": {
          "name": "customer_email",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "commission_cents": {
          "name": "commission_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_affiliate_commissions_affiliate": {
          "name": "idx_affiliate_commissions_affiliate",
          "columns": [
            "affiliate_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "affiliate_commissions_affiliate_id_affiliates_id_fk": {
          "name": "affiliate_commissions_affiliate_id_affiliates_id_fk",
          "tableFrom": "affiliate_commissions",
          "tableTo": "affiliates",
          "columnsFrom": [
            "affiliate_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "affiliate_commissions_order_id_orders_id_fk": {
          "name": "affiliate_commissions_order_id_orders_id_fk",
          "tableFrom": "affiliate_commissions",
          "tableTo": "orders",
          "columnsFrom": [
            "order_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "affiliate_commissions_organizer_id_users_id_fk": {
          "name": "affiliate_commissions_organizer_id_users_id_fk",
          "tableFrom": "affiliate_commissions",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "affiliate_commissions_id": {
          "name": "affiliate_commissions_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "affiliate_commissions_order_id_unique": {
          "name": "affiliate_commissions_order_id_unique",
          "columns": [
            "order_id"
          ]
        }
      },
      "checkConstraint": {}
    },
    "affiliates": {
      "name": "affiliates",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "code": {
          "name": "code",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "commission_percent": {
          "name": "commission_percent",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "total_clicks": {
          "name": "total_clicks",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "affiliates_organizer_code_key": {
          "name": "affiliates_organizer_code_key",
          "columns": [
            "organizer_id",
            "code"
          ],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "affiliates_organizer_id_users_id_fk": {
          "name": "affiliates_organizer_id_users_id_fk",
          "tableFrom": "affiliates",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "affiliates_id": {
          "name": "affiliates_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "commission_percent_range": {
          "name": "commission_percent_range",
          "value": "`affiliates`.`commission_percent` between 1 and 100"
        }
      }
    },
    "app_secrets": {
      "name": "app_secrets",
      "columns": {
        "key": {
          "name": "key",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_by": {
          "name": "updated_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "app_secrets_updated_by_users_id_fk": {
          "name": "app_secrets_updated_by_users_id_fk",
          "tableFrom": "app_secrets",
          "tableTo": "users",
          "columnsFrom": [
            "updated_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "app_secrets_key": {
          "name": "app_secrets_key",
          "columns": [
            "key"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "audit_log": {
      "name": "audit_log",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "actor_id": {
          "name": "actor_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "target_type": {
          "name": "target_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "target_id": {
          "name": "target_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "detail": {
          "name": "detail",
          "type": "json",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_audit_log_created": {
          "name": "idx_audit_log_created",
          "columns": [
            "created_at"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "audit_log_actor_id_users_id_fk": {
          "name": "audit_log_actor_id_users_id_fk",
          "tableFrom": "audit_log",
          "tableTo": "users",
          "columnsFrom": [
            "actor_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "audit_log_id": {
          "name": "audit_log_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "campaign_recipients": {
      "name": "campaign_recipients",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "customer_id": {
          "name": "customer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "destination": {
          "name": "destination",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('pending','sending','sent','failed','skipped_opt_out')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "provider_message_id": {
          "name": "provider_message_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "cost_cents": {
          "name": "cost_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        },
        "sent_at": {
          "name": "sent_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_campaign_recipients_campaign": {
          "name": "idx_campaign_recipients_campaign",
          "columns": [
            "campaign_id"
          ],
          "isUnique": false
        },
        "idx_campaign_recipients_pending": {
          "name": "idx_campaign_recipients_pending",
          "columns": [
            "campaign_id",
            "status"
          ],
          "isUnique": false
        },
        "idx_campaign_recipients_provider_message": {
          "name": "idx_campaign_recipients_provider_message",
          "columns": [
            "provider_message_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "campaign_recipients_campaign_id_campaigns_id_fk": {
          "name": "campaign_recipients_campaign_id_campaigns_id_fk",
          "tableFrom": "campaign_recipients",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "campaign_recipients_customer_id_customers_id_fk": {
          "name": "campaign_recipients_customer_id_customers_id_fk",
          "tableFrom": "campaign_recipients",
          "tableTo": "customers",
          "columnsFrom": [
            "customer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "campaign_recipients_id": {
          "name": "campaign_recipients_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "campaigns": {
      "name": "campaigns",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "channel": {
          "name": "channel",
          "type": "enum('sms','email')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "segment_id": {
          "name": "segment_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "body": {
          "name": "body",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('draft','queued','sending','sent','failed')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'draft'"
        },
        "currency": {
          "name": "currency",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'KES'"
        },
        "recipient_count": {
          "name": "recipient_count",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "sent_count": {
          "name": "sent_count",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "failed_count": {
          "name": "failed_count",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "skipped_count": {
          "name": "skipped_count",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "estimated_cost_cents": {
          "name": "estimated_cost_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "actual_cost_cents": {
          "name": "actual_cost_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_by": {
          "name": "created_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        },
        "queued_at": {
          "name": "queued_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "sent_at": {
          "name": "sent_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_campaigns_organizer": {
          "name": "idx_campaigns_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        },
        "idx_campaigns_status": {
          "name": "idx_campaigns_status",
          "columns": [
            "status",
            "queued_at"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "campaigns_organizer_id_users_id_fk": {
          "name": "campaigns_organizer_id_users_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "campaigns_segment_id_customer_segments_id_fk": {
          "name": "campaigns_segment_id_customer_segments_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "customer_segments",
          "columnsFrom": [
            "segment_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "campaigns_created_by_users_id_fk": {
          "name": "campaigns_created_by_users_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "users",
          "columnsFrom": [
            "created_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "campaigns_id": {
          "name": "campaigns_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "categories": {
      "name": "categories",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "slug": {
          "name": "slug",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "color": {
          "name": "color",
          "type": "varchar(20)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'#2D6CFF'"
        },
        "sort_order": {
          "name": "sort_order",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "categories_id": {
          "name": "categories_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "categories_slug_unique": {
          "name": "categories_slug_unique",
          "columns": [
            "slug"
          ]
        }
      },
      "checkConstraint": {}
    },
    "coupon_redemptions": {
      "name": "coupon_redemptions",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "coupon_id": {
          "name": "coupon_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_id": {
          "name": "order_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "customer_email": {
          "name": "customer_email",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "discount_cents": {
          "name": "discount_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_coupon_redemptions_coupon": {
          "name": "idx_coupon_redemptions_coupon",
          "columns": [
            "coupon_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "coupon_redemptions_coupon_id_coupons_id_fk": {
          "name": "coupon_redemptions_coupon_id_coupons_id_fk",
          "tableFrom": "coupon_redemptions",
          "tableTo": "coupons",
          "columnsFrom": [
            "coupon_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "coupon_redemptions_order_id_orders_id_fk": {
          "name": "coupon_redemptions_order_id_orders_id_fk",
          "tableFrom": "coupon_redemptions",
          "tableTo": "orders",
          "columnsFrom": [
            "order_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "coupon_redemptions_organizer_id_users_id_fk": {
          "name": "coupon_redemptions_organizer_id_users_id_fk",
          "tableFrom": "coupon_redemptions",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "coupon_redemptions_id": {
          "name": "coupon_redemptions_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "coupon_redemptions_order_id_unique": {
          "name": "coupon_redemptions_order_id_unique",
          "columns": [
            "order_id"
          ]
        }
      },
      "checkConstraint": {}
    },
    "coupons": {
      "name": "coupons",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "code": {
          "name": "code",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "kind": {
          "name": "kind",
          "type": "enum('percent','fixed')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "percent_off": {
          "name": "percent_off",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "amount_off_cents": {
          "name": "amount_off_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "max_redemptions": {
          "name": "max_redemptions",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "per_customer_limit": {
          "name": "per_customer_limit",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "starts_at": {
          "name": "starts_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "ends_at": {
          "name": "ends_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "coupons_organizer_code_key": {
          "name": "coupons_organizer_code_key",
          "columns": [
            "organizer_id",
            "code"
          ],
          "isUnique": true
        },
        "idx_coupons_event": {
          "name": "idx_coupons_event",
          "columns": [
            "event_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "coupons_organizer_id_users_id_fk": {
          "name": "coupons_organizer_id_users_id_fk",
          "tableFrom": "coupons",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "coupons_event_id_events_id_fk": {
          "name": "coupons_event_id_events_id_fk",
          "tableFrom": "coupons",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "coupons_id": {
          "name": "coupons_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "percent_off_range": {
          "name": "percent_off_range",
          "value": "`coupons`.`percent_off` is null or `coupons`.`percent_off` between 1 and 100"
        },
        "amount_off_non_negative": {
          "name": "amount_off_non_negative",
          "value": "`coupons`.`amount_off_cents` is null or `coupons`.`amount_off_cents` >= 0"
        },
        "max_redemptions_positive": {
          "name": "max_redemptions_positive",
          "value": "`coupons`.`max_redemptions` is null or `coupons`.`max_redemptions` > 0"
        },
        "per_customer_limit_positive": {
          "name": "per_customer_limit_positive",
          "value": "`coupons`.`per_customer_limit` is null or `coupons`.`per_customer_limit` > 0"
        },
        "kind_matches_discount_fields": {
          "name": "kind_matches_discount_fields",
          "value": "(`coupons`.`kind` = 'percent' and `coupons`.`percent_off` is not null and `coupons`.`amount_off_cents` is null)\n          or (`coupons`.`kind` = 'fixed' and `coupons`.`amount_off_cents` is not null and `coupons`.`percent_off` is null)"
        }
      }
    },
    "customer_segments": {
      "name": "customer_segments",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "filter": {
          "name": "filter",
          "type": "json",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_customer_segments_organizer": {
          "name": "idx_customer_segments_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "customer_segments_organizer_id_users_id_fk": {
          "name": "customer_segments_organizer_id_users_id_fk",
          "tableFrom": "customer_segments",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "customer_segments_id": {
          "name": "customer_segments_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "customers": {
      "name": "customers",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "email": {
          "name": "email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "full_name": {
          "name": "full_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "total_orders": {
          "name": "total_orders",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "total_spent_cents": {
          "name": "total_spent_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        },
        "sms_opt_in": {
          "name": "sms_opt_in",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "email_opt_in": {
          "name": "email_opt_in",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "sms_opted_out_at": {
          "name": "sms_opted_out_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "email_opted_out_at": {
          "name": "email_opted_out_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "customers_organizer_email_key": {
          "name": "customers_organizer_email_key",
          "columns": [
            "organizer_id",
            "email"
          ],
          "isUnique": true
        },
        "idx_customers_organizer": {
          "name": "idx_customers_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "customers_organizer_id_users_id_fk": {
          "name": "customers_organizer_id_users_id_fk",
          "tableFrom": "customers",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "customers_id": {
          "name": "customers_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "email_verification_codes": {
      "name": "email_verification_codes",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "email": {
          "name": "email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "code_hash": {
          "name": "code_hash",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "consumed_at": {
          "name": "consumed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_email_verification_codes_email": {
          "name": "idx_email_verification_codes_email",
          "columns": [
            "email"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "email_verification_codes_id": {
          "name": "email_verification_codes_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "event_cancellation_requests": {
      "name": "event_cancellation_requests",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "requested_by": {
          "name": "requested_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('pending','approved','rejected','withdrawn')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "resolution_note": {
          "name": "resolution_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "resolved_by": {
          "name": "resolved_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "pending_marker": {
          "name": "pending_marker",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false,
          "generated": {
            "as": "(case when `status` = 'pending' then `event_id` else null end)",
            "type": "stored"
          }
        }
      },
      "indexes": {
        "idx_event_cancellation_requests_status": {
          "name": "idx_event_cancellation_requests_status",
          "columns": [
            "status"
          ],
          "isUnique": false
        },
        "idx_event_cancellation_requests_event": {
          "name": "idx_event_cancellation_requests_event",
          "columns": [
            "event_id"
          ],
          "isUnique": false
        },
        "uniq_event_cancellation_pending_per_event": {
          "name": "uniq_event_cancellation_pending_per_event",
          "columns": [
            "pending_marker"
          ],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "event_cancellation_requests_event_id_events_id_fk": {
          "name": "event_cancellation_requests_event_id_events_id_fk",
          "tableFrom": "event_cancellation_requests",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "event_cancellation_requests_organizer_id_users_id_fk": {
          "name": "event_cancellation_requests_organizer_id_users_id_fk",
          "tableFrom": "event_cancellation_requests",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "event_cancellation_requests_requested_by_users_id_fk": {
          "name": "event_cancellation_requests_requested_by_users_id_fk",
          "tableFrom": "event_cancellation_requests",
          "tableTo": "users",
          "columnsFrom": [
            "requested_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "event_cancellation_requests_resolved_by_users_id_fk": {
          "name": "event_cancellation_requests_resolved_by_users_id_fk",
          "tableFrom": "event_cancellation_requests",
          "tableTo": "users",
          "columnsFrom": [
            "resolved_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "event_cancellation_requests_id": {
          "name": "event_cancellation_requests_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "event_links": {
      "name": "event_links",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "kind": {
          "name": "kind",
          "type": "enum('gallery','video','press')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'gallery'"
        },
        "sort_order": {
          "name": "sort_order",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_event_links_event": {
          "name": "idx_event_links_event",
          "columns": [
            "event_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "event_links_event_id_events_id_fk": {
          "name": "event_links_event_id_events_id_fk",
          "tableFrom": "event_links",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "event_links_id": {
          "name": "event_links_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "events": {
      "name": "events",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "venue": {
          "name": "venue",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "starts_at": {
          "name": "starts_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "ends_at": {
          "name": "ends_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "cover_image_url": {
          "name": "cover_image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('draft','published','cancelled')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'draft'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "fee_bps": {
          "name": "fee_bps",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 400
        },
        "category_id": {
          "name": "category_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "organizer_name": {
          "name": "organizer_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "organizer_phone": {
          "name": "organizer_phone",
          "type": "varchar(32)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "organizer_email": {
          "name": "organizer_email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "city": {
          "name": "city",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "age_restriction": {
          "name": "age_restriction",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "featured": {
          "name": "featured",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "slug": {
          "name": "slug",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_events_organizer": {
          "name": "idx_events_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        },
        "idx_events_category": {
          "name": "idx_events_category",
          "columns": [
            "category_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "events_organizer_id_users_id_fk": {
          "name": "events_organizer_id_users_id_fk",
          "tableFrom": "events",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "events_category_id_categories_id_fk": {
          "name": "events_category_id_categories_id_fk",
          "tableFrom": "events",
          "tableTo": "categories",
          "columnsFrom": [
            "category_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "events_id": {
          "name": "events_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "events_slug_unique": {
          "name": "events_slug_unique",
          "columns": [
            "slug"
          ]
        }
      },
      "checkConstraint": {}
    },
    "financing_requests": {
      "name": "financing_requests",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "requested_by": {
          "name": "requested_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "amount_cents": {
          "name": "amount_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "currency": {
          "name": "currency",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'kes'"
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('pending','approved','rejected','disbursed','repaid')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "repayment_rate_bps": {
          "name": "repayment_rate_bps",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 1200
        },
        "outstanding_cents": {
          "name": "outstanding_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "resolution_note": {
          "name": "resolution_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "resolved_by": {
          "name": "resolved_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "payout_account_id": {
          "name": "payout_account_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "disbursed_by": {
          "name": "disbursed_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "disbursed_at": {
          "name": "disbursed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        },
        "active_marker": {
          "name": "active_marker",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false,
          "generated": {
            "as": "(case when `status` in ('pending','approved','disbursed') then `organizer_id` else null end)",
            "type": "stored"
          }
        }
      },
      "indexes": {
        "idx_financing_requests_status": {
          "name": "idx_financing_requests_status",
          "columns": [
            "status"
          ],
          "isUnique": false
        },
        "idx_financing_requests_organizer": {
          "name": "idx_financing_requests_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        },
        "uniq_financing_active_per_organizer": {
          "name": "uniq_financing_active_per_organizer",
          "columns": [
            "active_marker"
          ],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "financing_requests_organizer_id_users_id_fk": {
          "name": "financing_requests_organizer_id_users_id_fk",
          "tableFrom": "financing_requests",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "financing_requests_requested_by_users_id_fk": {
          "name": "financing_requests_requested_by_users_id_fk",
          "tableFrom": "financing_requests",
          "tableTo": "users",
          "columnsFrom": [
            "requested_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "financing_requests_resolved_by_users_id_fk": {
          "name": "financing_requests_resolved_by_users_id_fk",
          "tableFrom": "financing_requests",
          "tableTo": "users",
          "columnsFrom": [
            "resolved_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "financing_requests_payout_account_id_payout_accounts_id_fk": {
          "name": "financing_requests_payout_account_id_payout_accounts_id_fk",
          "tableFrom": "financing_requests",
          "tableTo": "payout_accounts",
          "columnsFrom": [
            "payout_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "financing_requests_disbursed_by_users_id_fk": {
          "name": "financing_requests_disbursed_by_users_id_fk",
          "tableFrom": "financing_requests",
          "tableTo": "users",
          "columnsFrom": [
            "disbursed_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "financing_requests_id": {
          "name": "financing_requests_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "financing_amount_positive": {
          "name": "financing_amount_positive",
          "value": "`financing_requests`.`amount_cents` > 0"
        },
        "financing_outstanding_non_negative": {
          "name": "financing_outstanding_non_negative",
          "value": "`financing_requests`.`outstanding_cents` >= 0"
        },
        "financing_repayment_rate_range": {
          "name": "financing_repayment_rate_range",
          "value": "`financing_requests`.`repayment_rate_bps` > 0 and `financing_requests`.`repayment_rate_bps` <= 10000"
        }
      }
    },
    "gallery_albums": {
      "name": "gallery_albums",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "slug": {
          "name": "slug",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "concept": {
          "name": "concept",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "date_label": {
          "name": "date_label",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "venue": {
          "name": "venue",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "gallery_albums_event_id_events_id_fk": {
          "name": "gallery_albums_event_id_events_id_fk",
          "tableFrom": "gallery_albums",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "gallery_albums_id": {
          "name": "gallery_albums_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "gallery_albums_slug_unique": {
          "name": "gallery_albums_slug_unique",
          "columns": [
            "slug"
          ]
        }
      },
      "checkConstraint": {}
    },
    "gallery_photos": {
      "name": "gallery_photos",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "album_id": {
          "name": "album_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "status": {
          "name": "status",
          "type": "enum('pending','approved','rejected')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'approved'"
        },
        "kind": {
          "name": "kind",
          "type": "enum('photo','video')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'photo'"
        },
        "credit_name": {
          "name": "credit_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "credit_url": {
          "name": "credit_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "submitted_by": {
          "name": "submitted_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_gallery_photos_album": {
          "name": "idx_gallery_photos_album",
          "columns": [
            "album_id"
          ],
          "isUnique": false
        },
        "idx_gallery_photos_status": {
          "name": "idx_gallery_photos_status",
          "columns": [
            "status"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "gallery_photos_album_id_gallery_albums_id_fk": {
          "name": "gallery_photos_album_id_gallery_albums_id_fk",
          "tableFrom": "gallery_photos",
          "tableTo": "gallery_albums",
          "columnsFrom": [
            "album_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "gallery_photos_submitted_by_users_id_fk": {
          "name": "gallery_photos_submitted_by_users_id_fk",
          "tableFrom": "gallery_photos",
          "tableTo": "users",
          "columnsFrom": [
            "submitted_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "gallery_photos_id": {
          "name": "gallery_photos_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "merch_order_items": {
      "name": "merch_order_items",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_id": {
          "name": "order_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "product_id": {
          "name": "product_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "variant_id": {
          "name": "variant_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "product_name": {
          "name": "product_name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "variant_label": {
          "name": "variant_label",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "unit_cents": {
          "name": "unit_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "quantity": {
          "name": "quantity",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_merch_order_items_order": {
          "name": "idx_merch_order_items_order",
          "columns": [
            "order_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "merch_order_items_order_id_merch_orders_id_fk": {
          "name": "merch_order_items_order_id_merch_orders_id_fk",
          "tableFrom": "merch_order_items",
          "tableTo": "merch_orders",
          "columnsFrom": [
            "order_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "merch_order_items_product_id_merch_products_id_fk": {
          "name": "merch_order_items_product_id_merch_products_id_fk",
          "tableFrom": "merch_order_items",
          "tableTo": "merch_products",
          "columnsFrom": [
            "product_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "merch_order_items_variant_id_merch_variants_id_fk": {
          "name": "merch_order_items_variant_id_merch_variants_id_fk",
          "tableFrom": "merch_order_items",
          "tableTo": "merch_variants",
          "columnsFrom": [
            "variant_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "merch_order_items_id": {
          "name": "merch_order_items_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "merch_orders": {
      "name": "merch_orders",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "shop_id": {
          "name": "shop_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "buyer_name": {
          "name": "buyer_name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "buyer_email": {
          "name": "buyer_email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "buyer_phone": {
          "name": "buyer_phone",
          "type": "varchar(32)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "fulfillment": {
          "name": "fulfillment",
          "type": "enum('pickup','delivery')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "delivery_address": {
          "name": "delivery_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "delivery_city": {
          "name": "delivery_city",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "delivery_fee_cents": {
          "name": "delivery_fee_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "subtotal_cents": {
          "name": "subtotal_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "total_cents": {
          "name": "total_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "currency": {
          "name": "currency",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'kes'"
        },
        "status": {
          "name": "status",
          "type": "enum('pending','paid','cancelled','refunded')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "fulfillment_status": {
          "name": "fulfillment_status",
          "type": "enum('processing','ready','shipped','delivered','collected')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'processing'"
        },
        "tracking_note": {
          "name": "tracking_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "pickup_code": {
          "name": "pickup_code",
          "type": "varchar(12)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "payment_method": {
          "name": "payment_method",
          "type": "enum('card','mpesa')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "mpesa_checkout_request_id": {
          "name": "mpesa_checkout_request_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "mpesa_receipt": {
          "name": "mpesa_receipt",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "paystack_reference": {
          "name": "paystack_reference",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_merch_orders_shop": {
          "name": "idx_merch_orders_shop",
          "columns": [
            "shop_id"
          ],
          "isUnique": false
        },
        "idx_merch_orders_organizer": {
          "name": "idx_merch_orders_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "merch_orders_shop_id_merch_shops_id_fk": {
          "name": "merch_orders_shop_id_merch_shops_id_fk",
          "tableFrom": "merch_orders",
          "tableTo": "merch_shops",
          "columnsFrom": [
            "shop_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "merch_orders_organizer_id_users_id_fk": {
          "name": "merch_orders_organizer_id_users_id_fk",
          "tableFrom": "merch_orders",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "merch_orders_id": {
          "name": "merch_orders_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "merch_orders_mpesa_checkout_request_id_unique": {
          "name": "merch_orders_mpesa_checkout_request_id_unique",
          "columns": [
            "mpesa_checkout_request_id"
          ]
        },
        "merch_orders_paystack_reference_unique": {
          "name": "merch_orders_paystack_reference_unique",
          "columns": [
            "paystack_reference"
          ]
        }
      },
      "checkConstraint": {}
    },
    "merch_products": {
      "name": "merch_products",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "shop_id": {
          "name": "shop_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "varchar(160)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "image_url": {
          "name": "image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "price_cents": {
          "name": "price_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_merch_products_shop": {
          "name": "idx_merch_products_shop",
          "columns": [
            "shop_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "merch_products_shop_id_merch_shops_id_fk": {
          "name": "merch_products_shop_id_merch_shops_id_fk",
          "tableFrom": "merch_products",
          "tableTo": "merch_shops",
          "columnsFrom": [
            "shop_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "merch_products_event_id_events_id_fk": {
          "name": "merch_products_event_id_events_id_fk",
          "tableFrom": "merch_products",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "merch_products_id": {
          "name": "merch_products_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "merch_price_non_negative": {
          "name": "merch_price_non_negative",
          "value": "`merch_products`.`price_cents` >= 0"
        }
      }
    },
    "merch_shops": {
      "name": "merch_shops",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "slug": {
          "name": "slug",
          "type": "varchar(80)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "banner_url": {
          "name": "banner_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "pickup_instructions": {
          "name": "pickup_instructions",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "pickup_enabled": {
          "name": "pickup_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": true
        },
        "delivery_enabled": {
          "name": "delivery_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "delivery_fee_cents": {
          "name": "delivery_fee_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "open": {
          "name": "open",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "merch_shops_organizer_id_users_id_fk": {
          "name": "merch_shops_organizer_id_users_id_fk",
          "tableFrom": "merch_shops",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "merch_shops_id": {
          "name": "merch_shops_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "merch_shops_organizer_id_unique": {
          "name": "merch_shops_organizer_id_unique",
          "columns": [
            "organizer_id"
          ]
        },
        "merch_shops_slug_unique": {
          "name": "merch_shops_slug_unique",
          "columns": [
            "slug"
          ]
        }
      },
      "checkConstraint": {}
    },
    "merch_variants": {
      "name": "merch_variants",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "product_id": {
          "name": "product_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "label": {
          "name": "label",
          "type": "varchar(120)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "price_cents": {
          "name": "price_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "stock": {
          "name": "stock",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "sold": {
          "name": "sold",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "sort_order": {
          "name": "sort_order",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        }
      },
      "indexes": {
        "idx_merch_variants_product": {
          "name": "idx_merch_variants_product",
          "columns": [
            "product_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "merch_variants_product_id_merch_products_id_fk": {
          "name": "merch_variants_product_id_merch_products_id_fk",
          "tableFrom": "merch_variants",
          "tableTo": "merch_products",
          "columnsFrom": [
            "product_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "merch_variants_id": {
          "name": "merch_variants_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "merch_stock_non_negative": {
          "name": "merch_stock_non_negative",
          "value": "`merch_variants`.`stock` >= 0"
        }
      }
    },
    "orders": {
      "name": "orders",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "buyer_email": {
          "name": "buyer_email",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "buyer_name": {
          "name": "buyer_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "buyer_phone": {
          "name": "buyer_phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "stripe_session_id": {
          "name": "stripe_session_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "stripe_payment_intent": {
          "name": "stripe_payment_intent",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "total_cents": {
          "name": "total_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "currency": {
          "name": "currency",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'kes'"
        },
        "status": {
          "name": "status",
          "type": "enum('pending','paid','cancelled','refunded')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "payment_method": {
          "name": "payment_method",
          "type": "enum('card','mpesa','paypal','comp')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'card'"
        },
        "mpesa_checkout_request_id": {
          "name": "mpesa_checkout_request_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "mpesa_receipt": {
          "name": "mpesa_receipt",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "pending_items": {
          "name": "pending_items",
          "type": "json",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "paypal_order_id": {
          "name": "paypal_order_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "paypal_capture_id": {
          "name": "paypal_capture_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "paypal_amount_usd": {
          "name": "paypal_amount_usd",
          "type": "decimal(10,2)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "customer_id": {
          "name": "customer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "coupon_code": {
          "name": "coupon_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "affiliate_ref": {
          "name": "affiliate_ref",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "coupon_id": {
          "name": "coupon_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "discount_cents": {
          "name": "discount_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "affiliate_id": {
          "name": "affiliate_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "paystack_reference": {
          "name": "paystack_reference",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_orders_event": {
          "name": "idx_orders_event",
          "columns": [
            "event_id"
          ],
          "isUnique": false
        },
        "idx_orders_customer": {
          "name": "idx_orders_customer",
          "columns": [
            "customer_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "orders_event_id_events_id_fk": {
          "name": "orders_event_id_events_id_fk",
          "tableFrom": "orders",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "orders_customer_id_customers_id_fk": {
          "name": "orders_customer_id_customers_id_fk",
          "tableFrom": "orders",
          "tableTo": "customers",
          "columnsFrom": [
            "customer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "orders_coupon_id_coupons_id_fk": {
          "name": "orders_coupon_id_coupons_id_fk",
          "tableFrom": "orders",
          "tableTo": "coupons",
          "columnsFrom": [
            "coupon_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "orders_affiliate_id_affiliates_id_fk": {
          "name": "orders_affiliate_id_affiliates_id_fk",
          "tableFrom": "orders",
          "tableTo": "affiliates",
          "columnsFrom": [
            "affiliate_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "orders_id": {
          "name": "orders_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "orders_stripe_session_id_unique": {
          "name": "orders_stripe_session_id_unique",
          "columns": [
            "stripe_session_id"
          ]
        },
        "orders_mpesa_checkout_request_id_unique": {
          "name": "orders_mpesa_checkout_request_id_unique",
          "columns": [
            "mpesa_checkout_request_id"
          ]
        },
        "orders_paypal_order_id_unique": {
          "name": "orders_paypal_order_id_unique",
          "columns": [
            "paypal_order_id"
          ]
        },
        "orders_paystack_reference_unique": {
          "name": "orders_paystack_reference_unique",
          "columns": [
            "paystack_reference"
          ]
        }
      },
      "checkConstraint": {}
    },
    "otp_codes": {
      "name": "otp_codes",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "phone": {
          "name": "phone",
          "type": "varchar(32)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "code_hash": {
          "name": "code_hash",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "consumed_at": {
          "name": "consumed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {
        "idx_otp_codes_phone": {
          "name": "idx_otp_codes_phone",
          "columns": [
            "phone"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "otp_codes_id": {
          "name": "otp_codes_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "payout_accounts": {
      "name": "payout_accounts",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "type": {
          "name": "type",
          "type": "enum('mpesa','bank')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "mpesa_msisdn": {
          "name": "mpesa_msisdn",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "bank_name": {
          "name": "bank_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "bank_account_name": {
          "name": "bank_account_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "bank_account_number": {
          "name": "bank_account_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "bank_branch": {
          "name": "bank_branch",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "verified": {
          "name": "verified",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "withdrawal_requested_at": {
          "name": "withdrawal_requested_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "payout_accounts_organizer_id_users_id_fk": {
          "name": "payout_accounts_organizer_id_users_id_fk",
          "tableFrom": "payout_accounts",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "payout_accounts_id": {
          "name": "payout_accounts_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "payout_accounts_organizer_id_unique": {
          "name": "payout_accounts_organizer_id_unique",
          "columns": [
            "organizer_id"
          ]
        }
      },
      "checkConstraint": {}
    },
    "payouts": {
      "name": "payouts",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "payout_account_id": {
          "name": "payout_account_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "method": {
          "name": "method",
          "type": "enum('mpesa','bank')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "amount_cents": {
          "name": "amount_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "currency": {
          "name": "currency",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'kes'"
        },
        "status": {
          "name": "status",
          "type": "enum('pending','processing','paid','failed')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "destination": {
          "name": "destination",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "b2c_conversation_id": {
          "name": "b2c_conversation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "b2c_originator_conversation_id": {
          "name": "b2c_originator_conversation_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "b2c_transaction_id": {
          "name": "b2c_transaction_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "failure_reason": {
          "name": "failure_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_by": {
          "name": "created_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        },
        "paid_at": {
          "name": "paid_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_payouts_organizer": {
          "name": "idx_payouts_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        },
        "idx_payouts_status": {
          "name": "idx_payouts_status",
          "columns": [
            "status"
          ],
          "isUnique": false
        },
        "idx_payouts_b2c_originator": {
          "name": "idx_payouts_b2c_originator",
          "columns": [
            "b2c_originator_conversation_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "payouts_organizer_id_users_id_fk": {
          "name": "payouts_organizer_id_users_id_fk",
          "tableFrom": "payouts",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "payouts_payout_account_id_payout_accounts_id_fk": {
          "name": "payouts_payout_account_id_payout_accounts_id_fk",
          "tableFrom": "payouts",
          "tableTo": "payout_accounts",
          "columnsFrom": [
            "payout_account_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "payouts_created_by_users_id_fk": {
          "name": "payouts_created_by_users_id_fk",
          "tableFrom": "payouts",
          "tableTo": "users",
          "columnsFrom": [
            "created_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "payouts_id": {
          "name": "payouts_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "amount_cents_positive": {
          "name": "amount_cents_positive",
          "value": "`payouts`.`amount_cents` > 0"
        }
      }
    },
    "refund_requests": {
      "name": "refund_requests",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_id": {
          "name": "order_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "organizer_id": {
          "name": "organizer_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "requested_by": {
          "name": "requested_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "amount_cents": {
          "name": "amount_cents",
          "type": "bigint",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('pending','approved','rejected')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'pending'"
        },
        "resolution_note": {
          "name": "resolution_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "resolved_by": {
          "name": "resolved_by",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "resolved_at": {
          "name": "resolved_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "gateway": {
          "name": "gateway",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "gateway_refund_status": {
          "name": "gateway_refund_status",
          "type": "enum('pending','succeeded','failed')",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "gateway_refund_id": {
          "name": "gateway_refund_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "gateway_conversation_id": {
          "name": "gateway_conversation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "gateway_originator_conversation_id": {
          "name": "gateway_originator_conversation_id",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "gateway_error": {
          "name": "gateway_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "pending_marker": {
          "name": "pending_marker",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false,
          "generated": {
            "as": "(case when `status` = 'pending' then `order_id` else null end)",
            "type": "stored"
          }
        }
      },
      "indexes": {
        "idx_refund_requests_status": {
          "name": "idx_refund_requests_status",
          "columns": [
            "status"
          ],
          "isUnique": false
        },
        "idx_refund_requests_organizer": {
          "name": "idx_refund_requests_organizer",
          "columns": [
            "organizer_id"
          ],
          "isUnique": false
        },
        "idx_refund_requests_gateway_originator": {
          "name": "idx_refund_requests_gateway_originator",
          "columns": [
            "gateway_originator_conversation_id"
          ],
          "isUnique": false
        },
        "uniq_refund_pending_per_order": {
          "name": "uniq_refund_pending_per_order",
          "columns": [
            "pending_marker"
          ],
          "isUnique": true
        }
      },
      "foreignKeys": {
        "refund_requests_order_id_orders_id_fk": {
          "name": "refund_requests_order_id_orders_id_fk",
          "tableFrom": "refund_requests",
          "tableTo": "orders",
          "columnsFrom": [
            "order_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "refund_requests_event_id_events_id_fk": {
          "name": "refund_requests_event_id_events_id_fk",
          "tableFrom": "refund_requests",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "refund_requests_organizer_id_users_id_fk": {
          "name": "refund_requests_organizer_id_users_id_fk",
          "tableFrom": "refund_requests",
          "tableTo": "users",
          "columnsFrom": [
            "organizer_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "refund_requests_requested_by_users_id_fk": {
          "name": "refund_requests_requested_by_users_id_fk",
          "tableFrom": "refund_requests",
          "tableTo": "users",
          "columnsFrom": [
            "requested_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "refund_requests_resolved_by_users_id_fk": {
          "name": "refund_requests_resolved_by_users_id_fk",
          "tableFrom": "refund_requests",
          "tableTo": "users",
          "columnsFrom": [
            "resolved_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "refund_requests_id": {
          "name": "refund_requests_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "sessions": {
      "name": "sessions",
      "columns": {
        "sessionToken": {
          "name": "sessionToken",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "userId": {
          "name": "userId",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "expires": {
          "name": "expires",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sessions_userId_users_id_fk": {
          "name": "sessions_userId_users_id_fk",
          "tableFrom": "sessions",
          "tableTo": "users",
          "columnsFrom": [
            "userId"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "sessions_sessionToken": {
          "name": "sessions_sessionToken",
          "columns": [
            "sessionToken"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "site_settings": {
      "name": "site_settings",
      "columns": {
        "key": {
          "name": "key",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "value": {
          "name": "value",
          "type": "json",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "onUpdate": true,
          "default": "(now())"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "site_settings_key": {
          "name": "site_settings_key",
          "columns": [
            "key"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    },
    "ticket_types": {
      "name": "ticket_types",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "price_cents": {
          "name": "price_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "currency": {
          "name": "currency",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'kes'"
        },
        "quantity_total": {
          "name": "quantity_total",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "quantity_sold": {
          "name": "quantity_sold",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "original_price_cents": {
          "name": "original_price_cents",
          "type": "int",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "admits_count": {
          "name": "admits_count",
          "type": "int",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": 1
        },
        "sales_closed": {
          "name": "sales_closed",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": false
        },
        "sales_end_at": {
          "name": "sales_end_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_ticket_types_event": {
          "name": "idx_ticket_types_event",
          "columns": [
            "event_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "ticket_types_event_id_events_id_fk": {
          "name": "ticket_types_event_id_events_id_fk",
          "tableFrom": "ticket_types",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "ticket_types_id": {
          "name": "ticket_types_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {
        "price_cents_non_negative": {
          "name": "price_cents_non_negative",
          "value": "`ticket_types`.`price_cents` >= 0"
        },
        "quantity_total_non_negative": {
          "name": "quantity_total_non_negative",
          "value": "`ticket_types`.`quantity_total` >= 0"
        },
        "quantity_sold_non_negative": {
          "name": "quantity_sold_non_negative",
          "value": "`ticket_types`.`quantity_sold` >= 0"
        },
        "admits_count_positive": {
          "name": "admits_count_positive",
          "value": "`ticket_types`.`admits_count` >= 1"
        }
      }
    },
    "tickets": {
      "name": "tickets",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "order_id": {
          "name": "order_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "ticket_type_id": {
          "name": "ticket_type_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "event_id": {
          "name": "event_id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "code": {
          "name": "code",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "attendee_name": {
          "name": "attendee_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "attendee_email": {
          "name": "attendee_email",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "status": {
          "name": "status",
          "type": "enum('valid','used','void')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'valid'"
        },
        "checked_in_at": {
          "name": "checked_in_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        },
        "checked_in_gate": {
          "name": "checked_in_gate",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "signature": {
          "name": "signature",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        }
      },
      "indexes": {
        "idx_tickets_event": {
          "name": "idx_tickets_event",
          "columns": [
            "event_id"
          ],
          "isUnique": false
        },
        "idx_tickets_order": {
          "name": "idx_tickets_order",
          "columns": [
            "order_id"
          ],
          "isUnique": false
        }
      },
      "foreignKeys": {
        "tickets_order_id_orders_id_fk": {
          "name": "tickets_order_id_orders_id_fk",
          "tableFrom": "tickets",
          "tableTo": "orders",
          "columnsFrom": [
            "order_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "tickets_ticket_type_id_ticket_types_id_fk": {
          "name": "tickets_ticket_type_id_ticket_types_id_fk",
          "tableFrom": "tickets",
          "tableTo": "ticket_types",
          "columnsFrom": [
            "ticket_type_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "tickets_event_id_events_id_fk": {
          "name": "tickets_event_id_events_id_fk",
          "tableFrom": "tickets",
          "tableTo": "events",
          "columnsFrom": [
            "event_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {
        "tickets_id": {
          "name": "tickets_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "tickets_code_unique": {
          "name": "tickets_code_unique",
          "columns": [
            "code"
          ]
        }
      },
      "checkConstraint": {}
    },
    "users": {
      "name": "users",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar(36)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "email": {
          "name": "email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "emailVerified": {
          "name": "emailVerified",
          "type": "timestamp(3)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "image": {
          "name": "image",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "phone": {
          "name": "phone",
          "type": "varchar(32)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "password_hash": {
          "name": "password_hash",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false,
          "autoincrement": false
        },
        "role": {
          "name": "role",
          "type": "enum('admin','organizer')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'organizer'"
        },
        "status": {
          "name": "status",
          "type": "enum('active','suspended','banned')",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "'active'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false,
          "default": "(now())"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "users_id": {
          "name": "users_id",
          "columns": [
            "id"
          ]
        }
      },
      "uniqueConstraints": {
        "users_email_unique": {
          "name": "users_email_unique",
          "columns": [
            "email"
          ]
        },
        "users_phone_unique": {
          "name": "users_phone_unique",
          "columns": [
            "phone"
          ]
        }
      },
      "checkConstraint": {}
    },
    "verification_tokens": {
      "name": "verification_tokens",
      "columns": {
        "identifier": {
          "name": "identifier",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "token": {
          "name": "token",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        },
        "expires": {
          "name": "expires",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "autoincrement": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {
        "verification_tokens_identifier_token_pk": {
          "name": "verification_tokens_identifier_token_pk",
          "columns": [
            "identifier",
            "token"
          ]
        }
      },
      "uniqueConstraints": {},
      "checkConstraint": {}
    }
  },
  "views": {},
  "_meta": {
    "schemas": {},
    "tables": {},
    "columns": {}
  },
  "internal": {
    "tables": {},
    "indexes": {}
  }
}