summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/script/reset-db.ts
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-10-16 18:39:20 -0400
committerFrank <[email protected]>2025-10-16 22:28:09 -0400
commitca9b13e8a2626aca3bb28882cff395c18e0a215c (patch)
treec6e8aa5a1aa0c65263b9938604d15a898bccb263 /packages/console/core/script/reset-db.ts
parent92d9a0ec6106c2a51e389f06da5af6c742780e06 (diff)
downloadopencode-ca9b13e8a2626aca3bb28882cff395c18e0a215c.tar.gz
opencode-ca9b13e8a2626aca3bb28882cff395c18e0a215c.zip
wip: zen
Diffstat (limited to 'packages/console/core/script/reset-db.ts')
-rw-r--r--packages/console/core/script/reset-db.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/console/core/script/reset-db.ts b/packages/console/core/script/reset-db.ts
new file mode 100644
index 000000000..96ecf14e7
--- /dev/null
+++ b/packages/console/core/script/reset-db.ts
@@ -0,0 +1,13 @@
+import { Resource } from "@opencode-ai/console-resource"
+import { Database } from "@opencode-ai/console-core/drizzle/index.js"
+import { UserTable } from "@opencode-ai/console-core/schema/user.sql.js"
+import { AccountTable } from "@opencode-ai/console-core/schema/account.sql.js"
+import { WorkspaceTable } from "@opencode-ai/console-core/schema/workspace.sql.js"
+import { BillingTable, PaymentTable, UsageTable } from "@opencode-ai/console-core/schema/billing.sql.js"
+import { KeyTable } from "@opencode-ai/console-core/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))
+}