summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/script/reset-db.ts
blob: bd00e196290c14bad12ea26c3d6947acafa74828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { Resource } from "@opencode-ai/console-resource"
import { Database } from "../src/drizzle/index.js"
import { UserTable } from "../src/schema/user.sql.js"
import { AccountTable } from "../src/schema/account.sql.js"
import { WorkspaceTable } from "../src/schema/workspace.sql.js"
import { BillingTable, PaymentTable, UsageTable } from "../src/schema/billing.sql.js"
import { KeyTable } from "../src/schema/key.sql.js"

if (Resource.App.stage !== "frank") throw new Error("This script is only for frank")

for (const table of [
  AccountTable,
  BillingTable,
  KeyTable,
  PaymentTable,
  UsageTable,
  UserTable,
  WorkspaceTable,
]) {
  await Database.use((tx) => tx.delete(table))
}