Files
source-gamepanel/packages/database/src/schema/nodes.ts
T
2026-02-21 13:22:51 +03:00

34 lines
1.3 KiB
TypeScript

import {
pgTable,
uuid,
varchar,
integer,
bigint,
text,
boolean,
timestamp,
} from 'drizzle-orm/pg-core';
import { organizations } from './organizations';
export const nodes = pgTable('nodes', {
id: uuid('id').defaultRandom().primaryKey(),
organizationId: uuid('organization_id')
.notNull()
.references(() => organizations.id, { onDelete: 'cascade' }),
name: varchar('name', { length: 255 }).notNull(),
fqdn: varchar('fqdn', { length: 255 }).notNull(),
daemonPort: integer('daemon_port').default(8443).notNull(),
grpcPort: integer('grpc_port').default(50051).notNull(),
location: varchar('location', { length: 255 }),
memoryTotal: bigint('memory_total', { mode: 'number' }).notNull(),
diskTotal: bigint('disk_total', { mode: 'number' }).notNull(),
memoryOveralloc: integer('memory_overalloc').default(0).notNull(),
diskOveralloc: integer('disk_overalloc').default(0).notNull(),
daemonToken: text('daemon_token').notNull(),
tlsEnabled: boolean('tls_enabled').default(true).notNull(),
isOnline: boolean('is_online').default(false).notNull(),
lastHeartbeat: timestamp('last_heartbeat', { withTimezone: true }),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});