Przeglądaj źródła

chore: generate

opencode-agent[bot] 2 miesięcy temu
rodzic
commit
e4eb98b991
24 zmienionych plików z 215 dodań i 568 usunięć
  1. 10 6
      packages/console/app/src/component/go-referral.tsx
  2. 2 1
      packages/console/app/src/i18n/br.ts
  3. 2 1
      packages/console/app/src/i18n/da.ts
  4. 2 1
      packages/console/app/src/i18n/de.ts
  5. 2 1
      packages/console/app/src/i18n/es.ts
  6. 2 1
      packages/console/app/src/i18n/fr.ts
  7. 2 1
      packages/console/app/src/i18n/it.ts
  8. 4 2
      packages/console/app/src/i18n/ja.ts
  9. 2 1
      packages/console/app/src/i18n/no.ts
  10. 2 1
      packages/console/app/src/i18n/pl.ts
  11. 2 1
      packages/console/app/src/i18n/ru.ts
  12. 2 1
      packages/console/app/src/i18n/tr.ts
  13. 0 1
      packages/console/app/src/routes/black.css
  14. 0 1
      packages/console/app/src/routes/workspace/[id]/go/lite-section.module.css
  15. 2 1
      packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx
  16. 23 86
      packages/console/core/migrations/20260513173355_groovy_jane_foster/snapshot.json
  17. 24 85
      packages/console/core/migrations/20260516082200_long_spirit/snapshot.json
  18. 24 85
      packages/console/core/migrations/20260516110447_classy_wilson_fisk/snapshot.json
  19. 24 86
      packages/console/core/migrations/20260516112143_cynical_dexter_bennett/snapshot.json
  20. 24 86
      packages/console/core/migrations/20260516222132_referral_code_length/snapshot.json
  21. 24 86
      packages/console/core/migrations/20260518181630_secret_strong_guy/snapshot.json
  22. 34 25
      packages/console/core/src/referral.ts
  23. 1 4
      packages/console/core/src/schema/referral.sql.ts
  24. 1 4
      packages/console/core/src/schema/workspace.sql.ts

+ 10 - 6
packages/console/app/src/component/go-referral.tsx

@@ -35,10 +35,9 @@ export const queryGoReferralUsagePreview = query(async (workspaceID: string, ref
 
 export const applyGoReferralReward = action(async (workspaceID: string, referralID: string) => {
   "use server"
-  return json(
-    await withActor(() => Referral.applyReward({ referralID }), workspaceID),
-    { revalidate: [queryGoReferral.key, queryGoReferralUsagePreview.key, queryLiteSubscription.key] },
-  )
+  return json(await withActor(() => Referral.applyReward({ referralID }), workspaceID), {
+    revalidate: [queryGoReferral.key, queryGoReferralUsagePreview.key, queryLiteSubscription.key],
+  })
 }, "go.referral.reward.apply")
 
 function currentUsagePreview(usage: { resetInSec: number; usagePercent: number }) {
@@ -245,7 +244,11 @@ export function GoReferralSection(props: { workspaceID: string; summary: GoRefer
           </table>
         </div>
       </Show>
-      <Modal open={!!selected()} onClose={() => setSelected(undefined)} title={i18n.t("workspace.referral.apply.confirmTitle")}>
+      <Modal
+        open={!!selected()}
+        onClose={() => setSelected(undefined)}
+        title={i18n.t("workspace.referral.apply.confirmTitle")}
+      >
         <div data-component="go-credit-confirm">
           <p>
             {i18n.t("workspace.referral.apply.confirmBody", {
@@ -306,7 +309,8 @@ function GoReferralUsagePreviewRow(props: { label: string; usage: GoReferralUsag
         <div data-slot="usage-preview-after" style={{ width: `${props.usage.afterPercent}%` }} />
       </div>
       <span data-slot="usage-preview-reset">
-        {i18n.t("workspace.lite.subscription.resetsIn")} {formatResetTime(props.usage.resetInSec, i18n, liteResetTimeKeys)}
+        {i18n.t("workspace.lite.subscription.resetsIn")}{" "}
+        {formatResetTime(props.usage.resetInSec, i18n, liteResetTimeKeys)}
       </span>
     </div>
   )

+ 2 - 1
packages/console/app/src/i18n/br.ts

@@ -697,7 +697,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Visualizar",
   "workspace.referral.apply.action": "Aplicar",
   "workspace.referral.apply.confirmTitle": "Aplicar recompensa Go",
-  "workspace.referral.apply.confirmBody": "Aplique {{amount}} para reduzir os contadores atuais de uso do Go deste workspace.",
+  "workspace.referral.apply.confirmBody":
+    "Aplique {{amount}} para reduzir os contadores atuais de uso do Go deste workspace.",
   "workspace.referral.apply.confirmAction": "Aplicar",
 
   "download.title": "OpenCode | Baixar",

+ 2 - 1
packages/console/app/src/i18n/da.ts

@@ -693,7 +693,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Forhåndsvis",
   "workspace.referral.apply.action": "Brug",
   "workspace.referral.apply.confirmTitle": "Brug Go-belønning",
-  "workspace.referral.apply.confirmBody": "Brug {{amount}} til at reducere dette workspaces nuværende Go-forbrugstællere.",
+  "workspace.referral.apply.confirmBody":
+    "Brug {{amount}} til at reducere dette workspaces nuværende Go-forbrugstællere.",
   "workspace.referral.apply.confirmAction": "Brug",
 
   "download.title": "OpenCode | Download",

+ 2 - 1
packages/console/app/src/i18n/de.ts

@@ -696,7 +696,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Vorschau",
   "workspace.referral.apply.action": "Einlösen",
   "workspace.referral.apply.confirmTitle": "Go-Belohnung einlösen",
-  "workspace.referral.apply.confirmBody": "Löse {{amount}} ein, um die aktuellen Go-Nutzungszähler dieses Workspace zu reduzieren.",
+  "workspace.referral.apply.confirmBody":
+    "Löse {{amount}} ein, um die aktuellen Go-Nutzungszähler dieses Workspace zu reduzieren.",
   "workspace.referral.apply.confirmAction": "Einlösen",
 
   "download.title": "OpenCode | Download",

+ 2 - 1
packages/console/app/src/i18n/es.ts

@@ -697,7 +697,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Vista previa",
   "workspace.referral.apply.action": "Aplicar",
   "workspace.referral.apply.confirmTitle": "Aplicar recompensa de Go",
-  "workspace.referral.apply.confirmBody": "Aplica {{amount}} para reducir los contadores actuales de uso de Go de este workspace.",
+  "workspace.referral.apply.confirmBody":
+    "Aplica {{amount}} para reducir los contadores actuales de uso de Go de este workspace.",
   "workspace.referral.apply.confirmAction": "Aplicar",
 
   "download.title": "OpenCode | Descargar",

+ 2 - 1
packages/console/app/src/i18n/fr.ts

@@ -703,7 +703,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Aperçu",
   "workspace.referral.apply.action": "Utiliser",
   "workspace.referral.apply.confirmTitle": "Utiliser la récompense Go",
-  "workspace.referral.apply.confirmBody": "Utilisez {{amount}} pour réduire les compteurs d'utilisation Go actuels de ce workspace.",
+  "workspace.referral.apply.confirmBody":
+    "Utilisez {{amount}} pour réduire les compteurs d'utilisation Go actuels de ce workspace.",
   "workspace.referral.apply.confirmAction": "Utiliser",
 
   "download.title": "OpenCode | Téléchargement",

+ 2 - 1
packages/console/app/src/i18n/it.ts

@@ -695,7 +695,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Anteprima",
   "workspace.referral.apply.action": "Utilizza",
   "workspace.referral.apply.confirmTitle": "Utilizza premio Go",
-  "workspace.referral.apply.confirmBody": "Utilizza {{amount}} per ridurre i contatori di utilizzo Go attuali di questo workspace.",
+  "workspace.referral.apply.confirmBody":
+    "Utilizza {{amount}} per ridurre i contatori di utilizzo Go attuali di questo workspace.",
   "workspace.referral.apply.confirmAction": "Utilizza",
 
   "download.title": "OpenCode | Download",

+ 4 - 2
packages/console/app/src/i18n/ja.ts

@@ -671,7 +671,8 @@ export const dict = {
   "workspace.referral.copyLink": "リンクをコピー",
   "workspace.referral.copied": "コピーしました",
   "workspace.referral.overview.title": "友達を Go に招待",
-  "workspace.referral.overview.subtitle": "友達がサブスクライブすると $5 分の Go クレジットを獲得。友達にも $5 が付与されます。",
+  "workspace.referral.overview.subtitle":
+    "友達がサブスクライブすると $5 分の Go クレジットを獲得。友達にも $5 が付与されます。",
   "workspace.referral.stats.invites": "招待",
   "workspace.referral.stats.earned": "獲得",
   "workspace.referral.stats.applied": "適用済み",
@@ -695,7 +696,8 @@ export const dict = {
   "workspace.referral.apply.preview": "プレビュー",
   "workspace.referral.apply.action": "適用",
   "workspace.referral.apply.confirmTitle": "Go 特典を適用",
-  "workspace.referral.apply.confirmBody": "{{amount}} を適用して、このワークスペースの現在の Go 使用カウンターを減らします。",
+  "workspace.referral.apply.confirmBody":
+    "{{amount}} を適用して、このワークスペースの現在の Go 使用カウンターを減らします。",
   "workspace.referral.apply.confirmAction": "適用",
 
   "download.title": "OpenCode | ダウンロード",

+ 2 - 1
packages/console/app/src/i18n/no.ts

@@ -694,7 +694,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Forhåndsvis",
   "workspace.referral.apply.action": "Bruk",
   "workspace.referral.apply.confirmTitle": "Bruk Go-belønning",
-  "workspace.referral.apply.confirmBody": "Bruk {{amount}} for å redusere dette workspacets nåværende Go-forbrukstellere.",
+  "workspace.referral.apply.confirmBody":
+    "Bruk {{amount}} for å redusere dette workspacets nåværende Go-forbrukstellere.",
   "workspace.referral.apply.confirmAction": "Bruk",
 
   "download.title": "OpenCode | Last ned",

+ 2 - 1
packages/console/app/src/i18n/pl.ts

@@ -695,7 +695,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Podgląd",
   "workspace.referral.apply.action": "Wykorzystaj",
   "workspace.referral.apply.confirmTitle": "Wykorzystaj nagrodę Go",
-  "workspace.referral.apply.confirmBody": "Wykorzystaj {{amount}}, aby zmniejszyć aktualne liczniki użycia Go w tym workspace.",
+  "workspace.referral.apply.confirmBody":
+    "Wykorzystaj {{amount}}, aby zmniejszyć aktualne liczniki użycia Go w tym workspace.",
   "workspace.referral.apply.confirmAction": "Wykorzystaj",
 
   "download.title": "OpenCode | Pobierz",

+ 2 - 1
packages/console/app/src/i18n/ru.ts

@@ -701,7 +701,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Предпросмотр",
   "workspace.referral.apply.action": "Применить",
   "workspace.referral.apply.confirmTitle": "Применить награду Go",
-  "workspace.referral.apply.confirmBody": "Используйте {{amount}}, чтобы уменьшить текущие счётчики использования Go этого workspace.",
+  "workspace.referral.apply.confirmBody":
+    "Используйте {{amount}}, чтобы уменьшить текущие счётчики использования Go этого workspace.",
   "workspace.referral.apply.confirmAction": "Применить",
 
   "download.title": "OpenCode | Скачать",

+ 2 - 1
packages/console/app/src/i18n/tr.ts

@@ -697,7 +697,8 @@ export const dict = {
   "workspace.referral.apply.preview": "Önizleme",
   "workspace.referral.apply.action": "Kullan",
   "workspace.referral.apply.confirmTitle": "Go ödülünü kullan",
-  "workspace.referral.apply.confirmBody": "Bu workspace'in mevcut Go kullanım sayaçlarını azaltmak için {{amount}} kullan.",
+  "workspace.referral.apply.confirmBody":
+    "Bu workspace'in mevcut Go kullanım sayaçlarını azaltmak için {{amount}} kullan.",
   "workspace.referral.apply.confirmAction": "Kullan",
 
   "download.title": "OpenCode | İndir",

+ 0 - 1
packages/console/app/src/routes/black.css

@@ -700,7 +700,6 @@
           text-decoration: underline;
         }
       }
-
     }
   }
 

+ 0 - 1
packages/console/app/src/routes/workspace/[id]/go/lite-section.module.css

@@ -211,7 +211,6 @@
     align-items: center;
     gap: 4px;
   }
-
 }
 
 .paymentMethodModal {

+ 2 - 1
packages/console/app/src/routes/workspace/[id]/go/lite-section.tsx

@@ -140,7 +140,8 @@ function LiteUsageItem(props: { label: string; usage: { usagePercent: number; re
         <div data-slot="progress-bar" style={{ width: `${props.usage.usagePercent}%` }} />
       </div>
       <span data-slot="reset-time">
-        {i18n.t("workspace.lite.subscription.resetsIn")} {formatResetTime(props.usage.resetInSec, i18n, liteResetTimeKeys)}
+        {i18n.t("workspace.lite.subscription.resetsIn")}{" "}
+        {formatResetTime(props.usage.resetInSec, i18n, liteResetTimeKeys)}
       </span>
     </div>
   )

+ 23 - 86
packages/console/core/migrations/20260513173355_groovy_jane_foster/snapshot.json

@@ -2,9 +2,7 @@
   "version": "6",
   "dialect": "mysql",
   "id": "91a9afa8-a5b1-4fa4-b71d-b3ae866744c9",
-  "prevIds": [
-    "c742e0f2-5d89-4216-b843-059d00680f13"
-  ],
+  "prevIds": ["c742e0f2-5d89-4216-b843-059d00680f13"],
   "ddl": [
     {
       "name": "account",
@@ -2671,194 +2669,133 @@
       "table": "workspace"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "account",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "auth",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "benchmark",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "billing",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "email",
-        "type"
-      ],
+      "columns": ["email", "type"],
       "name": "PRIMARY",
       "table": "coupon",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "lite",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "payment",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "subscription",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "usage",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip",
-        "interval"
-      ],
+      "columns": ["ip", "interval"],
       "name": "PRIMARY",
       "table": "ip_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip"
-      ],
+      "columns": ["ip"],
       "name": "PRIMARY",
       "table": "ip",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "key",
-        "interval"
-      ],
+      "columns": ["key", "interval"],
       "name": "PRIMARY",
       "table": "key_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tpm_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tps_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "key",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "model",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "referral_code",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "referral_reward",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "referral",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "user",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "workspace",
       "entityType": "pks"

+ 24 - 85
packages/console/core/migrations/20260516082200_long_spirit/snapshot.json

@@ -2,10 +2,7 @@
   "version": "6",
   "dialect": "mysql",
   "id": "e93db4f6-6e8b-43f4-b883-59d2fd6ede53",
-  "prevIds": [
-    "1f04bd59-35b0-493b-9d55-cfa08207ba8e",
-    "91a9afa8-a5b1-4fa4-b71d-b3ae866744c9"
-  ],
+  "prevIds": ["1f04bd59-35b0-493b-9d55-cfa08207ba8e", "91a9afa8-a5b1-4fa4-b71d-b3ae866744c9"],
   "ddl": [
     {
       "name": "account",
@@ -2574,191 +2571,133 @@
       "table": "workspace"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "account",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "auth",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "benchmark",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "billing",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "email",
-        "type"
-      ],
+      "columns": ["email", "type"],
       "name": "PRIMARY",
       "table": "coupon",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "lite",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "payment",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "subscription",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "usage",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip",
-        "interval"
-      ],
+      "columns": ["ip", "interval"],
       "name": "PRIMARY",
       "table": "ip_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip"
-      ],
+      "columns": ["ip"],
       "name": "PRIMARY",
       "table": "ip",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "key",
-        "interval"
-      ],
+      "columns": ["key", "interval"],
       "name": "PRIMARY",
       "table": "key_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "model_sticky_provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tpm_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tps_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "key",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "model",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "user",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "referral_reward",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "referral",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "workspace",
       "entityType": "pks"
@@ -3121,4 +3060,4 @@
     }
   ],
   "renames": []
-}
+}

+ 24 - 85
packages/console/core/migrations/20260516110447_classy_wilson_fisk/snapshot.json

@@ -2,9 +2,7 @@
   "version": "6",
   "dialect": "mysql",
   "id": "77de1eaf-69f6-433f-b244-cda75319450a",
-  "prevIds": [
-    "e93db4f6-6e8b-43f4-b883-59d2fd6ede53"
-  ],
+  "prevIds": ["e93db4f6-6e8b-43f4-b883-59d2fd6ede53"],
   "ddl": [
     {
       "name": "account",
@@ -2559,192 +2557,133 @@
       "table": "workspace"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "account",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "auth",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "benchmark",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "billing",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "email",
-        "type"
-      ],
+      "columns": ["email", "type"],
       "name": "PRIMARY",
       "table": "coupon",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "lite",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "payment",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "subscription",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "usage",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip",
-        "interval"
-      ],
+      "columns": ["ip", "interval"],
       "name": "PRIMARY",
       "table": "ip_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip"
-      ],
+      "columns": ["ip"],
       "name": "PRIMARY",
       "table": "ip",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "key",
-        "interval"
-      ],
+      "columns": ["key", "interval"],
       "name": "PRIMARY",
       "table": "key_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "model_sticky_provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tpm_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tps_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "key",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "model",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "referral_id"
-      ],
+      "columns": ["workspace_id", "referral_id"],
       "name": "PRIMARY",
       "table": "referral_reward",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "user",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "referral",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "workspace",
       "entityType": "pks"
@@ -3087,4 +3026,4 @@
     }
   ],
   "renames": []
-}
+}

+ 24 - 86
packages/console/core/migrations/20260516112143_cynical_dexter_bennett/snapshot.json

@@ -2,9 +2,7 @@
   "version": "6",
   "dialect": "mysql",
   "id": "9809797a-e6f6-418c-8532-196553b315b8",
-  "prevIds": [
-    "77de1eaf-69f6-433f-b244-cda75319450a"
-  ],
+  "prevIds": ["77de1eaf-69f6-433f-b244-cda75319450a"],
   "ddl": [
     {
       "name": "account",
@@ -2559,193 +2557,133 @@
       "table": "workspace"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "account",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "auth",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "benchmark",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "billing",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "email",
-        "type"
-      ],
+      "columns": ["email", "type"],
       "name": "PRIMARY",
       "table": "coupon",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "lite",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "payment",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "subscription",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "usage",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip",
-        "interval"
-      ],
+      "columns": ["ip", "interval"],
       "name": "PRIMARY",
       "table": "ip_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip"
-      ],
+      "columns": ["ip"],
       "name": "PRIMARY",
       "table": "ip",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "key",
-        "interval"
-      ],
+      "columns": ["key", "interval"],
       "name": "PRIMARY",
       "table": "key_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "model_sticky_provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tpm_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tps_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "key",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "model",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "referral_id"
-      ],
+      "columns": ["workspace_id", "referral_id"],
       "name": "PRIMARY",
       "table": "referral_reward",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "referral",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "user",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "workspace",
       "entityType": "pks"
@@ -3072,4 +3010,4 @@
     }
   ],
   "renames": []
-}
+}

+ 24 - 86
packages/console/core/migrations/20260516222132_referral_code_length/snapshot.json

@@ -2,9 +2,7 @@
   "version": "6",
   "dialect": "mysql",
   "id": "e49321c9-2b03-4e2c-b2f0-76fbb88088ea",
-  "prevIds": [
-    "9809797a-e6f6-418c-8532-196553b315b8"
-  ],
+  "prevIds": ["9809797a-e6f6-418c-8532-196553b315b8"],
   "ddl": [
     {
       "name": "account",
@@ -2559,193 +2557,133 @@
       "table": "workspace"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "account",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "auth",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "benchmark",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "billing",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "email",
-        "type"
-      ],
+      "columns": ["email", "type"],
       "name": "PRIMARY",
       "table": "coupon",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "lite",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "payment",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "subscription",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "usage",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip",
-        "interval"
-      ],
+      "columns": ["ip", "interval"],
       "name": "PRIMARY",
       "table": "ip_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip"
-      ],
+      "columns": ["ip"],
       "name": "PRIMARY",
       "table": "ip",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "key",
-        "interval"
-      ],
+      "columns": ["key", "interval"],
       "name": "PRIMARY",
       "table": "key_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "model_sticky_provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tpm_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tps_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "key",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "model",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "referral_id"
-      ],
+      "columns": ["workspace_id", "referral_id"],
       "name": "PRIMARY",
       "table": "referral_reward",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "referral",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "user",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "workspace",
       "entityType": "pks"
@@ -3072,4 +3010,4 @@
     }
   ],
   "renames": []
-}
+}

+ 24 - 86
packages/console/core/migrations/20260518181630_secret_strong_guy/snapshot.json

@@ -2,9 +2,7 @@
   "version": "6",
   "dialect": "mysql",
   "id": "9a7123cb-5c2c-47f6-b22f-8fd6a02dcb03",
-  "prevIds": [
-    "e49321c9-2b03-4e2c-b2f0-76fbb88088ea"
-  ],
+  "prevIds": ["e49321c9-2b03-4e2c-b2f0-76fbb88088ea"],
   "ddl": [
     {
       "name": "account",
@@ -2559,193 +2557,133 @@
       "table": "workspace"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "account",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "auth",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "benchmark",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "billing",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "email",
-        "type"
-      ],
+      "columns": ["email", "type"],
       "name": "PRIMARY",
       "table": "coupon",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "lite",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "payment",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "subscription",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "usage",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip",
-        "interval"
-      ],
+      "columns": ["ip", "interval"],
       "name": "PRIMARY",
       "table": "ip_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "ip"
-      ],
+      "columns": ["ip"],
       "name": "PRIMARY",
       "table": "ip",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "key",
-        "interval"
-      ],
+      "columns": ["key", "interval"],
       "name": "PRIMARY",
       "table": "key_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "model_sticky_provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tpm_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id",
-        "interval"
-      ],
+      "columns": ["id", "interval"],
       "name": "PRIMARY",
       "table": "model_tps_rate_limit",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "key",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "model",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "provider",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "referral_id"
-      ],
+      "columns": ["workspace_id", "referral_id"],
       "name": "PRIMARY",
       "table": "referral_reward",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "referral",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "workspace_id",
-        "id"
-      ],
+      "columns": ["workspace_id", "id"],
       "name": "PRIMARY",
       "table": "user",
       "entityType": "pks"
     },
     {
-      "columns": [
-        "id"
-      ],
+      "columns": ["id"],
       "name": "PRIMARY",
       "table": "workspace",
       "entityType": "pks"
@@ -3072,4 +3010,4 @@
     }
   ],
   "renames": []
-}
+}

+ 34 - 25
packages/console/core/src/referral.ts

@@ -19,7 +19,10 @@ export namespace Referral {
   export const CODE_LENGTH = 10
 
   export function normalizeCode(code?: string | null) {
-    return code?.toUpperCase().replace(/[^A-Z0-9]/g, "").slice(0, CODE_LENGTH)
+    return code
+      ?.toUpperCase()
+      .replace(/[^A-Z0-9]/g, "")
+      .slice(0, CODE_LENGTH)
   }
 
   function generateCode() {
@@ -41,7 +44,11 @@ export namespace Referral {
           .update(WorkspaceTable)
           .set({ referralCode: generateCode() })
           .where(
-            and(eq(WorkspaceTable.id, workspaceID), isNull(WorkspaceTable.referralCode), isNull(WorkspaceTable.timeDeleted)),
+            and(
+              eq(WorkspaceTable.id, workspaceID),
+              isNull(WorkspaceTable.referralCode),
+              isNull(WorkspaceTable.timeDeleted),
+            ),
           )
 
         const created = await tx
@@ -74,7 +81,10 @@ export namespace Referral {
           })
           .from(ReferralRewardTable)
           .innerJoin(ReferralTable, eq(ReferralTable.id, ReferralRewardTable.referralID))
-          .innerJoin(AuthTable, and(eq(AuthTable.accountID, ReferralTable.inviteeAccountID), eq(AuthTable.provider, "email")))
+          .innerJoin(
+            AuthTable,
+            and(eq(AuthTable.accountID, ReferralTable.inviteeAccountID), eq(AuthTable.provider, "email")),
+          )
           .where(
             and(
               eq(ReferralRewardTable.workspaceID, workspaceID),
@@ -86,12 +96,18 @@ export namespace Referral {
         tx
           .select({ id: ReferralTable.id, inviteeEmail: AuthTable.subject, timeCreated: ReferralTable.timeCreated })
           .from(ReferralTable)
-          .innerJoin(AuthTable, and(eq(AuthTable.accountID, ReferralTable.inviteeAccountID), eq(AuthTable.provider, "email")))
+          .innerJoin(
+            AuthTable,
+            and(eq(AuthTable.accountID, ReferralTable.inviteeAccountID), eq(AuthTable.provider, "email")),
+          )
           .where(and(eq(ReferralTable.workspaceID, workspaceID), isNull(ReferralTable.timeDeleted))),
         tx
           .select({ id: ReferralTable.id, inviteeEmail: AuthTable.subject, timeCreated: ReferralTable.timeCreated })
           .from(ReferralTable)
-          .innerJoin(AuthTable, and(eq(AuthTable.accountID, ReferralTable.inviteeAccountID), eq(AuthTable.provider, "email")))
+          .innerJoin(
+            AuthTable,
+            and(eq(AuthTable.accountID, ReferralTable.inviteeAccountID), eq(AuthTable.provider, "email")),
+          )
           .where(and(eq(ReferralTable.inviteeAccountID, accountID), isNull(ReferralTable.timeDeleted))),
         tx
           .select({ referralID: ReferralRewardTable.referralID })
@@ -158,9 +174,7 @@ export namespace Referral {
       hasActiveGo: !!rows.lite,
       rewardAmount: microCentsToCents(REWARD_AMOUNT),
       totalEarned: rewards.reduce((total, reward) => total + reward.amount, 0),
-      totalApplied: rewards
-        .filter((reward) => reward.timeApplied)
-        .reduce((total, reward) => total + reward.amount, 0),
+      totalApplied: rewards.filter((reward) => reward.timeApplied).reduce((total, reward) => total + reward.amount, 0),
       rewards: allRewards,
     }
   })
@@ -277,10 +291,7 @@ export namespace Referral {
     }
   })
 
-  export async function createFromAccount(input: {
-    accountID: string
-    referralCode?: string
-  }) {
+  export async function createFromAccount(input: { accountID: string; referralCode?: string }) {
     const referralCode = normalizeCode(input.referralCode)
     if (!referralCode) return
 
@@ -313,14 +324,11 @@ export namespace Referral {
       if (selfReferral) throw new Error("Self-referral is not allowed")
 
       const referralID = Identifier.create("referral")
-      await tx
-        .insert(ReferralTable)
-        .ignore()
-        .values({
-          workspaceID: code.workspaceID,
-          id: referralID,
-          inviteeAccountID: input.accountID,
-        })
+      await tx.insert(ReferralTable).ignore().values({
+        workspaceID: code.workspaceID,
+        id: referralID,
+        inviteeAccountID: input.accountID,
+      })
 
       const referral = await tx
         .select({ id: ReferralTable.id, workspaceID: ReferralTable.workspaceID })
@@ -332,16 +340,17 @@ export namespace Referral {
     })
   }
 
-  export async function completeFromLiteSubscription(input: {
-    workspaceID: string
-    userID: string
-  }) {
+  export async function completeFromLiteSubscription(input: { workspaceID: string; userID: string }) {
     return Database.transaction(async (tx) => {
       const invitee = await tx
         .select({ accountID: UserTable.accountID })
         .from(UserTable)
         .where(
-          and(eq(UserTable.workspaceID, input.workspaceID), eq(UserTable.id, input.userID), isNull(UserTable.timeDeleted)),
+          and(
+            eq(UserTable.workspaceID, input.workspaceID),
+            eq(UserTable.id, input.userID),
+            isNull(UserTable.timeDeleted),
+          ),
         )
         .then((rows) => rows[0])
       if (!invitee?.accountID) throw new Error("Referral invitee account missing")

+ 1 - 4
packages/console/core/src/schema/referral.sql.ts

@@ -9,10 +9,7 @@ export const ReferralTable = mysqlTable(
     ...timestamps,
     inviteeAccountID: ulid("invitee_account_id").notNull(),
   },
-  (table) => [
-    ...workspaceIndexes(table),
-    uniqueIndex("referral_invitee_account_id").on(table.inviteeAccountID),
-  ],
+  (table) => [...workspaceIndexes(table), uniqueIndex("referral_invitee_account_id").on(table.inviteeAccountID)],
 )
 
 export const ReferralRewardTable = mysqlTable(

+ 1 - 4
packages/console/core/src/schema/workspace.sql.ts

@@ -10,10 +10,7 @@ export const WorkspaceTable = mysqlTable(
     name: varchar("name", { length: 255 }).notNull(),
     ...timestamps,
   },
-  (table) => [
-    uniqueIndex("slug").on(table.slug),
-    uniqueIndex("referral_code").on(table.referralCode),
-  ],
+  (table) => [uniqueIndex("slug").on(table.slug), uniqueIndex("referral_code").on(table.referralCode)],
 )
 
 export function workspaceIndexes(table: any) {