Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/database/migrations/0004_uneven_silver_sable.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE `perf_snapshots` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`session_id` integer NOT NULL,
`ts` integer NOT NULL,
`players` integer DEFAULT 0 NOT NULL,
`fxs_memory` integer,
`node_memory` integer,
`perf` text NOT NULL,
FOREIGN KEY (`session_id`) REFERENCES `server_sessions`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `perf_snapshot_session_ts_idx` ON `perf_snapshots` (`session_id`,`ts`);--> statement-breakpoint
CREATE TABLE `server_sessions` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`started_at` integer NOT NULL,
`ended_at` integer,
`close_reason` text
);
--> statement-breakpoint
CREATE INDEX `server_session_started_idx` ON `server_sessions` (`started_at`);
9 changes: 9 additions & 0 deletions packages/database/migrations/0005_chubby_daredevil.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE TABLE `disconnect_events` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`session_id` integer NOT NULL,
`ts` integer NOT NULL,
`category` text NOT NULL,
FOREIGN KEY (`session_id`) REFERENCES `server_sessions`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `disconnect_event_session_ts_idx` ON `disconnect_events` (`session_id`,`ts`);
11 changes: 11 additions & 0 deletions packages/database/migrations/0006_productive_thor.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CREATE TABLE `admin_groups` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`name` text NOT NULL,
`permissions` integer DEFAULT 0 NOT NULL,
`colour` text DEFAULT '#ffffff' NOT NULL,
`icon` text,
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `admin_groups_name_unique` ON `admin_groups` (`name`);--> statement-breakpoint
ALTER TABLE `admin_users` ADD `group_id` integer REFERENCES admin_groups(id);
13 changes: 13 additions & 0 deletions packages/database/migrations/0007_petite_skrulls.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE `player_sessions` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`player_id` integer NOT NULL,
`server_session_id` integer,
`connected_at` integer NOT NULL,
`disconnected_at` integer,
`duration_ms` integer,
`end_reason` text,
FOREIGN KEY (`player_id`) REFERENCES `players`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`server_session_id`) REFERENCES `server_sessions`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE INDEX `player_session_player_connected_idx` ON `player_sessions` (`player_id`,`connected_at`);
Loading
Loading