cloudaxe-opencode/packages/console/core/src/schema/ip.sql.ts

64 lines
1.8 KiB
TypeScript
Raw Normal View History

2026-04-21 02:21:06 +00:00
import { mysqlTable, int, primaryKey, varchar, bigint } from "drizzle-orm/mysql-core"
2025-11-25 22:57:15 +00:00
import { timestamps } from "../drizzle/types"
export const IpTable = mysqlTable(
"ip",
{
ip: varchar("ip", { length: 45 }).notNull(),
...timestamps,
usage: int("usage"),
},
(table) => [primaryKey({ columns: [table.ip] })],
)
2026-01-06 21:16:33 +00:00
export const IpRateLimitTable = mysqlTable(
"ip_rate_limit",
{
ip: varchar("ip", { length: 45 }).notNull(),
interval: varchar("interval", { length: 10 }).notNull(),
count: int("count").notNull(),
},
(table) => [primaryKey({ columns: [table.ip, table.interval] })],
)
2026-04-15 00:29:21 +00:00
export const KeyRateLimitTable = mysqlTable(
"key_rate_limit",
{
key: varchar("key", { length: 255 }).notNull(),
interval: varchar("interval", { length: 40 }).notNull(),
count: int("count").notNull(),
},
(table) => [primaryKey({ columns: [table.key, table.interval] })],
)
2026-04-17 13:54:44 +00:00
2026-04-21 02:21:06 +00:00
export const ModelTpmRateLimitTable = mysqlTable(
"model_tpm_rate_limit",
2026-04-20 19:02:50 +00:00
{
id: varchar("id", { length: 255 }).notNull(),
2026-04-21 02:21:06 +00:00
interval: bigint("interval", { mode: "number" }).notNull(),
2026-04-20 19:02:50 +00:00
count: int("count").notNull(),
},
2026-04-21 02:41:30 +00:00
(table) => [primaryKey({ columns: [table.id, table.interval] })],
2026-04-20 19:02:50 +00:00
)
2026-05-11 22:32:37 +00:00
export const ModelTpsRateLimitTable = mysqlTable(
"model_tps_rate_limit",
{
id: varchar("id", { length: 255 }).notNull(),
interval: bigint("interval", { mode: "number" }).notNull(),
qualify: int("qualify").notNull(),
unqualify: int("unqualify").notNull(),
},
(table) => [primaryKey({ columns: [table.id, table.interval] })],
)
2026-05-13 16:45:08 +00:00
export const ModelStickyProviderTable = mysqlTable(
"model_sticky_provider",
{
id: varchar("id", { length: 255 }).notNull(),
...timestamps,
providerId: varchar("provider_id", { length: 255 }).notNull(),
},
(table) => [primaryKey({ columns: [table.id] })],
)