summaryrefslogtreecommitdiffhomepage
path: root/cloud/core/src/schema
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-09-18 01:32:40 -0400
committerFrank <[email protected]>2025-09-18 01:32:40 -0400
commitfc4f281408c56ab12db571a470456212a479edf5 (patch)
tree309d23b0c497bc61af6f8e650a6036fa41d7cbdb /cloud/core/src/schema
parentf8c4f713a5b48892899d0ac195c3470ab7ef764c (diff)
downloadopencode-fc4f281408c56ab12db571a470456212a479edf5.tar.gz
opencode-fc4f281408c56ab12db571a470456212a479edf5.zip
wip: zen
Diffstat (limited to 'cloud/core/src/schema')
-rw-r--r--cloud/core/src/schema/account.sql.ts12
-rw-r--r--cloud/core/src/schema/billing.sql.ts53
-rw-r--r--cloud/core/src/schema/key.sql.ts22
-rw-r--r--cloud/core/src/schema/user.sql.ts16
-rw-r--r--cloud/core/src/schema/workspace.sql.ts21
5 files changed, 0 insertions, 124 deletions
diff --git a/cloud/core/src/schema/account.sql.ts b/cloud/core/src/schema/account.sql.ts
deleted file mode 100644
index 4d9937114..000000000
--- a/cloud/core/src/schema/account.sql.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { mysqlTable, uniqueIndex, varchar } from "drizzle-orm/mysql-core"
-import { id, timestamps } from "../drizzle/types"
-
-export const AccountTable = mysqlTable(
- "account",
- {
- id: id(),
- ...timestamps,
- email: varchar("email", { length: 255 }).notNull(),
- },
- (table) => [uniqueIndex("email").on(table.email)],
-)
diff --git a/cloud/core/src/schema/billing.sql.ts b/cloud/core/src/schema/billing.sql.ts
deleted file mode 100644
index 5bec4e900..000000000
--- a/cloud/core/src/schema/billing.sql.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { bigint, boolean, int, mysqlTable, uniqueIndex, varchar } from "drizzle-orm/mysql-core"
-import { timestamps, utc, workspaceColumns } from "../drizzle/types"
-import { workspaceIndexes } from "./workspace.sql"
-
-export const BillingTable = mysqlTable(
- "billing",
- {
- ...workspaceColumns,
- ...timestamps,
- customerID: varchar("customer_id", { length: 255 }),
- paymentMethodID: varchar("payment_method_id", { length: 255 }),
- paymentMethodLast4: varchar("payment_method_last4", { length: 4 }),
- balance: bigint("balance", { mode: "number" }).notNull(),
- monthlyLimit: int("monthly_limit"),
- monthlyUsage: bigint("monthly_usage", { mode: "number" }),
- timeMonthlyUsageUpdated: utc("time_monthly_usage_updated"),
- reload: boolean("reload"),
- reloadError: varchar("reload_error", { length: 255 }),
- timeReloadError: utc("time_reload_error"),
- timeReloadLockedTill: utc("time_reload_locked_till"),
- },
- (table) => [...workspaceIndexes(table), uniqueIndex("global_customer_id").on(table.customerID)],
-)
-
-export const PaymentTable = mysqlTable(
- "payment",
- {
- ...workspaceColumns,
- ...timestamps,
- customerID: varchar("customer_id", { length: 255 }),
- paymentID: varchar("payment_id", { length: 255 }),
- amount: bigint("amount", { mode: "number" }).notNull(),
- },
- (table) => [...workspaceIndexes(table)],
-)
-
-export const UsageTable = mysqlTable(
- "usage",
- {
- ...workspaceColumns,
- ...timestamps,
- model: varchar("model", { length: 255 }).notNull(),
- provider: varchar("provider", { length: 255 }).notNull(),
- inputTokens: int("input_tokens").notNull(),
- outputTokens: int("output_tokens").notNull(),
- reasoningTokens: int("reasoning_tokens"),
- cacheReadTokens: int("cache_read_tokens"),
- cacheWrite5mTokens: int("cache_write_5m_tokens"),
- cacheWrite1hTokens: int("cache_write_1h_tokens"),
- cost: bigint("cost", { mode: "number" }).notNull(),
- },
- (table) => [...workspaceIndexes(table)],
-)
diff --git a/cloud/core/src/schema/key.sql.ts b/cloud/core/src/schema/key.sql.ts
deleted file mode 100644
index 98b99c788..000000000
--- a/cloud/core/src/schema/key.sql.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { mysqlTable, varchar, uniqueIndex, json } from "drizzle-orm/mysql-core"
-import { timestamps, utc, workspaceColumns } from "../drizzle/types"
-import { workspaceIndexes } from "./workspace.sql"
-import { Actor } from "../actor"
-
-export const KeyTable = mysqlTable(
- "key",
- {
- ...workspaceColumns,
- ...timestamps,
- actor: json("actor").$type<Actor.Info>(),
- name: varchar("name", { length: 255 }).notNull(),
- oldName: varchar("old_name", { length: 255 }),
- key: varchar("key", { length: 255 }).notNull(),
- timeUsed: utc("time_used"),
- },
- (table) => [
- ...workspaceIndexes(table),
- uniqueIndex("global_key").on(table.key),
- uniqueIndex("name").on(table.workspaceID, table.name),
- ],
-)
diff --git a/cloud/core/src/schema/user.sql.ts b/cloud/core/src/schema/user.sql.ts
deleted file mode 100644
index 00c372d1a..000000000
--- a/cloud/core/src/schema/user.sql.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { text, mysqlTable, uniqueIndex, varchar, int } from "drizzle-orm/mysql-core"
-import { timestamps, utc, workspaceColumns } from "../drizzle/types"
-import { workspaceIndexes } from "./workspace.sql"
-
-export const UserTable = mysqlTable(
- "user",
- {
- ...workspaceColumns,
- ...timestamps,
- email: varchar("email", { length: 255 }).notNull(),
- name: varchar("name", { length: 255 }).notNull(),
- timeSeen: utc("time_seen"),
- color: int("color"),
- },
- (table) => [...workspaceIndexes(table), uniqueIndex("user_email").on(table.workspaceID, table.email)],
-)
diff --git a/cloud/core/src/schema/workspace.sql.ts b/cloud/core/src/schema/workspace.sql.ts
deleted file mode 100644
index 979255428..000000000
--- a/cloud/core/src/schema/workspace.sql.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import { primaryKey, mysqlTable, uniqueIndex, varchar } from "drizzle-orm/mysql-core"
-import { timestamps, ulid } from "../drizzle/types"
-
-export const WorkspaceTable = mysqlTable(
- "workspace",
- {
- id: ulid("id").notNull().primaryKey(),
- slug: varchar("slug", { length: 255 }),
- name: varchar("name", { length: 255 }),
- ...timestamps,
- },
- (table) => [uniqueIndex("slug").on(table.slug)],
-)
-
-export function workspaceIndexes(table: any) {
- return [
- primaryKey({
- columns: [table.workspaceID, table.id],
- }),
- ]
-}