{
  "id": "987cd5e1-584e-4333-adb8-3e1ba68db29f",
  "prevId": "e44e6564-5691-40f3-8c77-1f5e48c56ebd",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.account": {
      "name": "account",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "account_id": {
          "name": "account_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "provider_id": {
          "name": "provider_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "access_token": {
          "name": "access_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "refresh_token": {
          "name": "refresh_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "id_token": {
          "name": "id_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "access_token_expires_at": {
          "name": "access_token_expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "refresh_token_expires_at": {
          "name": "refresh_token_expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "scope": {
          "name": "scope",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password": {
          "name": "password",
          "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
        }
      },
      "indexes": {
        "account_userId_idx": {
          "name": "account_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "account_user_id_user_id_fk": {
          "name": "account_user_id_user_id_fk",
          "tableFrom": "account",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.invitation": {
      "name": "invitation",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "inviter_id": {
          "name": "inviter_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "invitation_organizationId_idx": {
          "name": "invitation_organizationId_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "invitation_email_idx": {
          "name": "invitation_email_idx",
          "columns": [
            {
              "expression": "email",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "invitation_organization_id_organization_id_fk": {
          "name": "invitation_organization_id_organization_id_fk",
          "tableFrom": "invitation",
          "tableTo": "organization",
          "columnsFrom": ["organization_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "invitation_inviter_id_user_id_fk": {
          "name": "invitation_inviter_id_user_id_fk",
          "tableFrom": "invitation",
          "tableTo": "user",
          "columnsFrom": ["inviter_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.member": {
      "name": "member",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "organization_id": {
          "name": "organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'member'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "member_organizationId_idx": {
          "name": "member_organizationId_idx",
          "columns": [
            {
              "expression": "organization_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "member_userId_idx": {
          "name": "member_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "member_organization_id_organization_id_fk": {
          "name": "member_organization_id_organization_id_fk",
          "tableFrom": "member",
          "tableTo": "organization",
          "columnsFrom": ["organization_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "member_user_id_user_id_fk": {
          "name": "member_user_id_user_id_fk",
          "tableFrom": "member",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.organization": {
      "name": "organization",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "slug": {
          "name": "slug",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "logo": {
          "name": "logo",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "metadata": {
          "name": "metadata",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "organization_slug_unique": {
          "name": "organization_slug_unique",
          "nullsNotDistinct": false,
          "columns": ["slug"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.passkey": {
      "name": "passkey",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "public_key": {
          "name": "public_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "credential_id": {
          "name": "credential_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "counter": {
          "name": "counter",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "device_type": {
          "name": "device_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "backed_up": {
          "name": "backed_up",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true
        },
        "transports": {
          "name": "transports",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "aaguid": {
          "name": "aaguid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "passkey_userId_idx": {
          "name": "passkey_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "passkey_credentialID_idx": {
          "name": "passkey_credentialID_idx",
          "columns": [
            {
              "expression": "credential_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "passkey_user_id_user_id_fk": {
          "name": "passkey_user_id_user_id_fk",
          "tableFrom": "passkey",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.session": {
      "name": "session",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "token": {
          "name": "token",
          "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
        },
        "ip_address": {
          "name": "ip_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "impersonated_by": {
          "name": "impersonated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "active_organization_id": {
          "name": "active_organization_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {
        "session_userId_idx": {
          "name": "session_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "session_user_id_user_id_fk": {
          "name": "session_user_id_user_id_fk",
          "tableFrom": "session",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "session_token_unique": {
          "name": "session_token_unique",
          "nullsNotDistinct": false,
          "columns": ["token"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.two_factor": {
      "name": "two_factor",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "secret": {
          "name": "secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "backup_codes": {
          "name": "backup_codes",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {
        "twoFactor_secret_idx": {
          "name": "twoFactor_secret_idx",
          "columns": [
            {
              "expression": "secret",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "twoFactor_userId_idx": {
          "name": "twoFactor_userId_idx",
          "columns": [
            {
              "expression": "user_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "two_factor_user_id_user_id_fk": {
          "name": "two_factor_user_id_user_id_fk",
          "tableFrom": "two_factor",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user": {
      "name": "user",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email_verified": {
          "name": "email_verified",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "image": {
          "name": "image",
          "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()"
        },
        "two_factor_enabled": {
          "name": "two_factor_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "is_anonymous": {
          "name": "is_anonymous",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "banned": {
          "name": "banned",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "ban_reason": {
          "name": "ban_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ban_expires": {
          "name": "ban_expires",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "user_email_unique": {
          "name": "user_email_unique",
          "nullsNotDistinct": false,
          "columns": ["email"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.verification": {
      "name": "verification",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "identifier": {
          "name": "identifier",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "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": {
        "verification_identifier_idx": {
          "name": "verification_identifier_idx",
          "columns": [
            {
              "expression": "identifier",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.credit_transaction": {
      "name": "credit_transaction",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "customer_id": {
          "name": "customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "credit_transaction_type",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "balance_after": {
          "name": "balance_after",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_by": {
          "name": "created_by",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "credit_transaction_customer_id_customer_id_fk": {
          "name": "credit_transaction_customer_id_customer_id_fk",
          "tableFrom": "credit_transaction",
          "tableTo": "customer",
          "columnsFrom": ["customer_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.customer": {
      "name": "customer",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_id": {
          "name": "customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "status",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": false
        },
        "plan": {
          "name": "plan",
          "type": "plan",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": false
        },
        "credits": {
          "name": "credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        }
      },
      "indexes": {},
      "foreignKeys": {
        "customer_user_id_user_id_fk": {
          "name": "customer_user_id_user_id_fk",
          "tableFrom": "customer",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "customer_userId_unique": {
          "name": "customer_userId_unique",
          "nullsNotDistinct": false,
          "columns": ["user_id"]
        },
        "customer_customerId_unique": {
          "name": "customer_customerId_unique",
          "nullsNotDistinct": false,
          "columns": ["customer_id"]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.diagram": {
      "name": "diagram",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "diagram_type",
          "typeSchema": "public",
          "primaryKey": false,
          "notNull": true
        },
        "graph_data": {
          "name": "graph_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "project_id": {
          "name": "project_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "last_ai_message": {
          "name": "last_ai_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "diagram_user_id_user_id_fk": {
          "name": "diagram_user_id_user_id_fk",
          "tableFrom": "diagram",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.project": {
      "name": "project",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "project_user_id_user_id_fk": {
          "name": "project_user_id_user_id_fk",
          "tableFrom": "project",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "chat.chat": {
      "name": "chat",
      "schema": "chat",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "diagram_id": {
          "name": "diagram_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {
        "chat_diagram_id_idx": {
          "name": "chat_diagram_id_idx",
          "columns": [
            {
              "expression": "diagram_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "chat_user_id_user_id_fk": {
          "name": "chat_user_id_user_id_fk",
          "tableFrom": "chat",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "chat.message": {
      "name": "message",
      "schema": "chat",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "role",
          "typeSchema": "chat",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "message_chat_id_chat_id_fk": {
          "name": "message_chat_id_chat_id_fk",
          "tableFrom": "message",
          "tableTo": "chat",
          "schemaTo": "chat",
          "columnsFrom": ["chat_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "chat.part": {
      "name": "part",
      "schema": "chat",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "message_id": {
          "name": "message_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "order": {
          "name": "order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "details": {
          "name": "details",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "part_message_id_message_id_fk": {
          "name": "part_message_id_message_id_fk",
          "tableFrom": "part",
          "tableTo": "message",
          "schemaTo": "chat",
          "columnsFrom": ["message_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "pdf.chat": {
      "name": "chat",
      "schema": "pdf",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "chat_user_id_user_id_fk": {
          "name": "chat_user_id_user_id_fk",
          "tableFrom": "chat",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "pdf.citation_unit": {
      "name": "citation_unit",
      "schema": "pdf",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "document_id": {
          "name": "document_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "retrieval_chunk_id": {
          "name": "retrieval_chunk_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "page_number": {
          "name": "page_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "paragraph_index": {
          "name": "paragraph_index",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "char_start": {
          "name": "char_start",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "char_end": {
          "name": "char_end",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "bbox_x": {
          "name": "bbox_x",
          "type": "real",
          "primaryKey": false,
          "notNull": false
        },
        "bbox_y": {
          "name": "bbox_y",
          "type": "real",
          "primaryKey": false,
          "notNull": false
        },
        "bbox_width": {
          "name": "bbox_width",
          "type": "real",
          "primaryKey": false,
          "notNull": false
        },
        "bbox_height": {
          "name": "bbox_height",
          "type": "real",
          "primaryKey": false,
          "notNull": false
        },
        "section_title": {
          "name": "section_title",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "unit_type": {
          "name": "unit_type",
          "type": "unit_type",
          "typeSchema": "pdf",
          "primaryKey": false,
          "notNull": false,
          "default": "'prose'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {
        "idx_cu_document": {
          "name": "idx_cu_document",
          "columns": [
            {
              "expression": "document_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_cu_retrieval": {
          "name": "idx_cu_retrieval",
          "columns": [
            {
              "expression": "retrieval_chunk_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_cu_page": {
          "name": "idx_cu_page",
          "columns": [
            {
              "expression": "document_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "page_number",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_cu_unique": {
          "name": "idx_cu_unique",
          "columns": [
            {
              "expression": "document_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "page_number",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            },
            {
              "expression": "paragraph_index",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": true,
          "concurrently": false,
          "method": "btree",
          "with": {}
        }
      },
      "foreignKeys": {
        "citation_unit_document_id_document_id_fk": {
          "name": "citation_unit_document_id_document_id_fk",
          "tableFrom": "citation_unit",
          "tableTo": "document",
          "schemaTo": "pdf",
          "columnsFrom": ["document_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        },
        "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk": {
          "name": "citation_unit_retrieval_chunk_id_retrieval_chunk_id_fk",
          "tableFrom": "citation_unit",
          "tableTo": "retrieval_chunk",
          "schemaTo": "pdf",
          "columnsFrom": ["retrieval_chunk_id"],
          "columnsTo": ["id"],
          "onDelete": "set null",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "pdf.document": {
      "name": "document",
      "schema": "pdf",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "path": {
          "name": "path",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "processing_status": {
          "name": "processing_status",
          "type": "processing_status",
          "typeSchema": "pdf",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "processing_error": {
          "name": "processing_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "document_chat_id_chat_id_fk": {
          "name": "document_chat_id_chat_id_fk",
          "tableFrom": "document",
          "tableTo": "chat",
          "schemaTo": "pdf",
          "columnsFrom": ["chat_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "pdf.embedding": {
      "name": "embedding",
      "schema": "pdf",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "document_id": {
          "name": "document_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "embedding": {
          "name": "embedding",
          "type": "vector(1536)",
          "primaryKey": false,
          "notNull": true
        },
        "page_number": {
          "name": "page_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "char_start": {
          "name": "char_start",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "char_end": {
          "name": "char_end",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "section_title": {
          "name": "section_title",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {
        "pdf_embeddingIndex": {
          "name": "pdf_embeddingIndex",
          "columns": [
            {
              "expression": "embedding",
              "isExpression": false,
              "asc": true,
              "nulls": "last",
              "opclass": "vector_cosine_ops"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "hnsw",
          "with": {}
        }
      },
      "foreignKeys": {
        "embedding_document_id_document_id_fk": {
          "name": "embedding_document_id_document_id_fk",
          "tableFrom": "embedding",
          "tableTo": "document",
          "schemaTo": "pdf",
          "columnsFrom": ["document_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "pdf.message": {
      "name": "message",
      "schema": "pdf",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "chat_id": {
          "name": "chat_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "role",
          "typeSchema": "pdf",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "message_chat_id_chat_id_fk": {
          "name": "message_chat_id_chat_id_fk",
          "tableFrom": "message",
          "tableTo": "chat",
          "schemaTo": "pdf",
          "columnsFrom": ["chat_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "pdf.retrieval_chunk": {
      "name": "retrieval_chunk",
      "schema": "pdf",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "document_id": {
          "name": "document_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "embedding": {
          "name": "embedding",
          "type": "vector(1536)",
          "primaryKey": false,
          "notNull": false
        },
        "page_start": {
          "name": "page_start",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "page_end": {
          "name": "page_end",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "section_hierarchy": {
          "name": "section_hierarchy",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "chunk_type": {
          "name": "chunk_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'prose'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {
        "idx_rc_document": {
          "name": "idx_rc_document",
          "columns": [
            {
              "expression": "document_id",
              "isExpression": false,
              "asc": true,
              "nulls": "last"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "btree",
          "with": {}
        },
        "idx_rc_embedding": {
          "name": "idx_rc_embedding",
          "columns": [
            {
              "expression": "embedding",
              "isExpression": false,
              "asc": true,
              "nulls": "last",
              "opclass": "vector_cosine_ops"
            }
          ],
          "isUnique": false,
          "concurrently": false,
          "method": "hnsw",
          "with": {}
        }
      },
      "foreignKeys": {
        "retrieval_chunk_document_id_document_id_fk": {
          "name": "retrieval_chunk_document_id_document_id_fk",
          "tableFrom": "retrieval_chunk",
          "tableTo": "document",
          "schemaTo": "pdf",
          "columnsFrom": ["document_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "image.generation": {
      "name": "generation",
      "schema": "image",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "prompt": {
          "name": "prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model": {
          "name": "model",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "aspect_ratio": {
          "name": "aspect_ratio",
          "type": "aspect_ratio",
          "typeSchema": "image",
          "primaryKey": false,
          "notNull": true,
          "default": "'square'"
        },
        "count": {
          "name": "count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "user_id": {
          "name": "user_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "generation_user_id_user_id_fk": {
          "name": "generation_user_id_user_id_fk",
          "tableFrom": "generation",
          "tableTo": "user",
          "columnsFrom": ["user_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "image.image": {
      "name": "image",
      "schema": "image",
      "columns": {
        "id": {
          "name": "id",
          "type": "text",
          "primaryKey": true,
          "notNull": true
        },
        "generation_id": {
          "name": "generation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "image_generation_id_generation_id_fk": {
          "name": "image_generation_id_generation_id_fk",
          "tableFrom": "image",
          "tableTo": "generation",
          "schemaTo": "image",
          "columnsFrom": ["generation_id"],
          "columnsTo": ["id"],
          "onDelete": "cascade",
          "onUpdate": "cascade"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {
    "public.credit_transaction_type": {
      "name": "credit_transaction_type",
      "schema": "public",
      "values": [
        "signup",
        "purchase",
        "usage",
        "admin_grant",
        "admin_deduct",
        "refund",
        "promo",
        "referral",
        "expiry"
      ]
    },
    "public.status": {
      "name": "status",
      "schema": "public",
      "values": [
        "active",
        "canceled",
        "incomplete",
        "incomplete_expired",
        "past_due",
        "paused",
        "trialing",
        "unpaid"
      ]
    },
    "public.plan": {
      "name": "plan",
      "schema": "public",
      "values": ["free", "premium", "enterprise"]
    },
    "public.diagram_type": {
      "name": "diagram_type",
      "schema": "public",
      "values": [
        "bpmn",
        "er",
        "orgchart",
        "architecture",
        "sequence",
        "flowchart"
      ]
    },
    "chat.role": {
      "name": "role",
      "schema": "chat",
      "values": ["system", "assistant", "user"]
    },
    "pdf.role": {
      "name": "role",
      "schema": "pdf",
      "values": ["user", "assistant", "system"]
    },
    "pdf.processing_status": {
      "name": "processing_status",
      "schema": "pdf",
      "values": ["pending", "processing", "ready", "failed"]
    },
    "pdf.unit_type": {
      "name": "unit_type",
      "schema": "pdf",
      "values": ["prose", "heading", "list", "table", "code"]
    },
    "image.aspect_ratio": {
      "name": "aspect_ratio",
      "schema": "image",
      "values": ["square", "standard", "landscape", "portrait"]
    }
  },
  "schemas": {
    "pdf": "pdf"
  },
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}
