{
  "id": "bb113291-d5b3-4e90-954a-074c2ef6c5e4",
  "prevId": "ae054fb5-75c6-4043-9cf2-aad14d4c815c",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.cart_items": {
      "name": "cart_items",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "cart_id": {
          "name": "cart_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "product_id": {
          "name": "product_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "quantity": {
          "name": "quantity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "added_at": {
          "name": "added_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "cart_items_cart_id_carts_id_fk": {
          "name": "cart_items_cart_id_carts_id_fk",
          "tableFrom": "cart_items",
          "tableTo": "carts",
          "columnsFrom": [
            "cart_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "cart_items_product_id_products_id_fk": {
          "name": "cart_items_product_id_products_id_fk",
          "tableFrom": "cart_items",
          "tableTo": "products",
          "columnsFrom": [
            "product_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "restrict",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.carts": {
      "name": "carts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": false
        },
        "session_id": {
          "name": "session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "carts_user_id_users_id_fk": {
          "name": "carts_user_id_users_id_fk",
          "tableFrom": "carts",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.order_items": {
      "name": "order_items",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "order_id": {
          "name": "order_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "product_id": {
          "name": "product_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "product_snapshot": {
          "name": "product_snapshot",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "quantity": {
          "name": "quantity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "price_snapshot": {
          "name": "price_snapshot",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "order_items_order_id_orders_id_fk": {
          "name": "order_items_order_id_orders_id_fk",
          "tableFrom": "order_items",
          "tableTo": "orders",
          "columnsFrom": [
            "order_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "order_items_product_id_products_id_fk": {
          "name": "order_items_product_id_products_id_fk",
          "tableFrom": "order_items",
          "tableTo": "products",
          "columnsFrom": [
            "product_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "restrict",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.orders": {
      "name": "orders",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "order_number": {
          "name": "order_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "total_amount": {
          "name": "total_amount",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "order_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "billing_address": {
          "name": "billing_address",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "payment_id": {
          "name": "payment_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "payment_completed_at": {
          "name": "payment_completed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "orders_order_number_idx": {
          "name": "orders_order_number_idx",
          "columns": [
            {
              "expression": "order_number",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "orders_user_id_idx": {
          "name": "orders_user_id_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "orders_status_idx": {
          "name": "orders_status_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "orders_user_id_users_id_fk": {
          "name": "orders_user_id_users_id_fk",
          "tableFrom": "orders",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "restrict",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "orders_order_number_unique": {
          "name": "orders_order_number_unique",
          "nullsNotDistinct": false,
          "columns": [
            "order_number"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.product_role_visibility": {
      "name": "product_role_visibility",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "product_id": {
          "name": "product_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role_code": {
          "name": "role_code",
          "type": "role_code",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "product_role_visibility_product_id_role_code_unique": {
          "name": "product_role_visibility_product_id_role_code_unique",
          "columns": [
            {
              "expression": "product_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "role_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "product_role_visibility_product_id_idx": {
          "name": "product_role_visibility_product_id_idx",
          "columns": [
            {
              "expression": "product_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "product_role_visibility_role_code_idx": {
          "name": "product_role_visibility_role_code_idx",
          "columns": [
            {
              "expression": "role_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "product_role_visibility_product_id_products_id_fk": {
          "name": "product_role_visibility_product_id_products_id_fk",
          "tableFrom": "product_role_visibility",
          "tableTo": "products",
          "columnsFrom": [
            "product_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "product_role_visibility_role_code_roles_code_fk": {
          "name": "product_role_visibility_role_code_roles_code_fk",
          "tableFrom": "product_role_visibility",
          "tableTo": "roles",
          "columnsFrom": [
            "role_code"
          ],
          "columnsTo": [
            "code"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.products": {
      "name": "products",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "nav_product_id": {
          "name": "nav_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "price": {
          "name": "price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "stock_quantity": {
          "name": "stock_quantity",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "image_url": {
          "name": "image_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "products_nav_product_id_idx": {
          "name": "products_nav_product_id_idx",
          "columns": [
            {
              "expression": "nav_product_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "products_active_idx": {
          "name": "products_active_idx",
          "columns": [
            {
              "expression": "active",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "products_category_idx": {
          "name": "products_category_idx",
          "columns": [
            {
              "expression": "category",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "products_nav_product_id_unique": {
          "name": "products_nav_product_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "nav_product_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.roles": {
      "name": "roles",
      "schema": "",
      "columns": {
        "code": {
          "name": "code",
          "type": "role_code",
          "typeSchema": "public",
          "primaryKey": true,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "requires_approval": {
          "name": "requires_approval",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "active": {
          "name": "active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user_roles": {
      "name": "user_roles",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "uuid",
          "primaryKey": false,
          "notNull": true
        },
        "role_code": {
          "name": "role_code",
          "type": "role_code",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "role_request_status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "organization_name": {
          "name": "organization_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "admin_notes": {
          "name": "admin_notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status_history": {
          "name": "status_history",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true,
          "default": "'[]'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {
        "user_roles_user_id_role_code_unique": {
          "name": "user_roles_user_id_role_code_unique",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "role_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "user_roles_user_id_idx": {
          "name": "user_roles_user_id_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "user_roles_role_code_idx": {
          "name": "user_roles_role_code_idx",
          "columns": [
            {
              "expression": "role_code",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "user_roles_status_idx": {
          "name": "user_roles_status_idx",
          "columns": [
            {
              "expression": "status",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "user_roles_user_id_users_id_fk": {
          "name": "user_roles_user_id_users_id_fk",
          "tableFrom": "user_roles",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "user_roles_role_code_roles_code_fk": {
          "name": "user_roles_role_code_roles_code_fk",
          "tableFrom": "user_roles",
          "tableTo": "roles",
          "columnsFrom": [
            "role_code"
          ],
          "columnsTo": [
            "code"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "uuid",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "experimenta_id": {
          "name": "experimenta_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "first_name": {
          "name": "first_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "last_name": {
          "name": "last_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "salutation": {
          "name": "salutation",
          "type": "salutation",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": false
        },
        "date_of_birth": {
          "name": "date_of_birth",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "street": {
          "name": "street",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "post_code": {
          "name": "post_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "city": {
          "name": "city",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "country_code": {
          "name": "country_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_experimenta_id_unique": {
          "name": "users_experimenta_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "experimenta_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {
    "public.order_status": {
      "name": "order_status",
      "schema": "public",
      "values": [
        "pending",
        "paid",
        "processing",
        "completed",
        "failed"
      ]
    },
    "public.role_code": {
      "name": "role_code",
      "schema": "public",
      "values": [
        "private",
        "educator",
        "company"
      ]
    },
    "public.role_request_status": {
      "name": "role_request_status",
      "schema": "public",
      "values": [
        "pending",
        "approved",
        "rejected"
      ]
    },
    "public.salutation": {
      "name": "salutation",
      "schema": "public",
      "values": [
        "male",
        "female",
        "other"
      ]
    }
  },
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}