| 1 | import { |
| 2 | boolean, |
| 3 | index, |
| 4 | int, |
| 5 | mysqlTable, |
| 6 | text, |
| 7 | timestamp, |
| 8 | varchar, |
| 9 | } from "drizzle-orm/mysql-core"; |
| 10 | import { user } |
| 11 | import { nodes } |
| 12 | import { eggs } |
| 13 | import { nodeAllocations } |
| 14 | |
| 15 | export const servers = |
| 16 | "servers", |
| 17 | { |
| 18 | id: varchar("id |
| 19 | uuid: varchar("uuid |
| 20 | uuidShort: varchar("uuid_short |
| 21 | name: varchar("name |
| 22 | description: text("description |
| 23 | userId: varchar("user_id |
| 24 | .notNull() |
| 25 | .references(() => |
| 26 | nodeId: varchar("node_id |
| 27 | .notNull() |
| 28 | .references(() => |
| 29 | eggId: varchar("egg_id |
| 30 | .notNull() |
| 31 | .references(() => |
| 32 | allocationId: varchar("allocation_id |
| 33 | .notNull() |
| 34 | .references(() => |
| 35 | status: varchar("status |
| 36 | powerState: varchar("power_state |
| 37 | suspended: boolean("suspended |
| 38 | memory: int("memory |
| 39 | disk: int("disk |
| 40 | cpu: int("cpu |
| 41 | swap: int("swap |
| 42 | io: int("io |
| 43 | threads: varchar("threads |
| 44 | oomDisabled: boolean("oom_disabled |
| 45 | image: varchar("image |
| 46 | startup: text("startup |
| 47 | skipScripts: boolean("skip_scripts |
| 48 | invocation: text("invocation |
| 49 | subscriptionId: varchar("subscription_id |
| 50 | createdAt: timestamp("created_at |
| 51 | updatedAt: timestamp("updated_at |
| 52 | .defaultNow() |
| 53 | .$onUpdate(() => |
| 54 | .notNull(), |
| 55 | }, |
| 56 | (table) => |
| 57 | index("servers_userId_idx"). |
| 58 | index("servers_nodeId_idx"). |
| 59 | index("servers_eggId_idx"). |
| 60 | index("servers_subscriptionId_idx"). |
| 61 | ], |
| 62 | ); |