Add panel feature updates across API, daemon, and web

This commit is contained in:
2026-03-02 21:53:54 +00:00
parent 6b463c2b1a
commit afc64b83c1
49 changed files with 7040 additions and 305 deletions
+1
View File
@@ -8,3 +8,4 @@ export * from './backups';
export * from './plugins';
export * from './schedules';
export * from './audit-logs';
export * from './server-databases';
+46
View File
@@ -6,11 +6,17 @@ import {
boolean,
timestamp,
pgEnum,
jsonb,
bigint,
} from 'drizzle-orm/pg-core';
import { games } from './games';
import { servers } from './servers';
import { users } from './users';
export const pluginSourceEnum = pgEnum('plugin_source', ['spiget', 'manual']);
export const pluginReleaseChannelEnum = pgEnum('plugin_release_channel', ['stable', 'beta', 'alpha']);
export const pluginReleaseArtifactTypeEnum = pgEnum('plugin_release_artifact_type', ['file', 'zip']);
export const pluginInstallStatusEnum = pgEnum('plugin_install_status', ['installed', 'updating', 'failed']);
export const plugins = pgTable('plugins', {
id: uuid('id').defaultRandom().primaryKey(),
@@ -24,6 +30,29 @@ export const plugins = pgTable('plugins', {
externalId: varchar('external_id', { length: 255 }),
downloadUrl: text('download_url'),
version: varchar('version', { length: 100 }),
isGlobal: boolean('is_global').default(true).notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});
export const pluginReleases = pgTable('plugin_releases', {
id: uuid('id').defaultRandom().primaryKey(),
pluginId: uuid('plugin_id')
.notNull()
.references(() => plugins.id, { onDelete: 'cascade' }),
version: varchar('version', { length: 100 }).notNull(),
channel: pluginReleaseChannelEnum('channel').default('stable').notNull(),
artifactType: pluginReleaseArtifactTypeEnum('artifact_type').default('file').notNull(),
artifactUrl: text('artifact_url').notNull(),
destination: text('destination'),
fileName: varchar('file_name', { length: 255 }),
checksumSha256: varchar('checksum_sha256', { length: 128 }),
sizeBytes: bigint('size_bytes', { mode: 'number' }),
changelog: text('changelog'),
installSchema: jsonb('install_schema').default([]).notNull(),
configTemplates: jsonb('config_templates').default([]).notNull(),
isPublished: boolean('is_published').default(true).notNull(),
createdByUserId: uuid('created_by_user_id').references(() => users.id, { onDelete: 'set null' }),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});
@@ -36,7 +65,24 @@ export const serverPlugins = pgTable('server_plugins', {
pluginId: uuid('plugin_id')
.notNull()
.references(() => plugins.id, { onDelete: 'cascade' }),
releaseId: uuid('release_id').references(() => pluginReleases.id, { onDelete: 'set null' }),
installedVersion: varchar('installed_version', { length: 100 }),
isActive: boolean('is_active').default(true).notNull(),
installOptions: jsonb('install_options').default({}).notNull(),
autoUpdateChannel: pluginReleaseChannelEnum('auto_update_channel').default('stable').notNull(),
isPinned: boolean('is_pinned').default(false).notNull(),
status: pluginInstallStatusEnum('status').default('installed').notNull(),
lastError: text('last_error'),
installedAt: timestamp('installed_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});
export const serverPluginFiles = pgTable('server_plugin_files', {
id: uuid('id').defaultRandom().primaryKey(),
serverPluginId: uuid('server_plugin_id')
.notNull()
.references(() => serverPlugins.id, { onDelete: 'cascade' }),
path: text('path').notNull(),
kind: varchar('kind', { length: 32 }).default('artifact').notNull(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
});
@@ -0,0 +1,25 @@
import {
pgTable,
uuid,
varchar,
text,
integer,
timestamp,
} from 'drizzle-orm/pg-core';
import { servers } from './servers';
export const serverDatabases = pgTable('server_databases', {
id: uuid('id').defaultRandom().primaryKey(),
serverId: uuid('server_id')
.notNull()
.references(() => servers.id, { onDelete: 'cascade' }),
name: varchar('name', { length: 255 }).notNull(),
databaseName: varchar('database_name', { length: 255 }).notNull().unique(),
username: varchar('username', { length: 64 }).notNull().unique(),
password: text('password').notNull(),
host: varchar('host', { length: 255 }).notNull(),
port: integer('port').notNull(),
phpMyAdminUrl: text('phpmyadmin_url'),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow().notNull(),
});