Files
BoosAPI/drizzle/0002_token_model_availability.sql
T
cita 9405d468d9 Add initial database schema and journal entries for token management
- Created a new snapshot JSON file (0003_snapshot.json) defining the schema for tables including account_tokens, accounts, checkin_logs, events, model_availability, proxy_logs, route_channels, settings, sites, token_model_availability, and token_routes.
- Added columns, indexes, and foreign key constraints for each table to ensure data integrity and relationships.
- Introduced a journal JSON file (_journal.json) to track schema versions and changes, including entries for version 6 with relevant tags and timestamps.
2026-02-28 22:20:28 +08:00

13 lines
521 B
SQL

CREATE TABLE IF NOT EXISTS `token_model_availability` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`token_id` integer NOT NULL,
`model_name` text NOT NULL,
`available` integer,
`latency_ms` integer,
`checked_at` text DEFAULT (datetime('now')),
FOREIGN KEY (`token_id`) REFERENCES `account_tokens`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS `token_model_availability_token_model_unique`
ON `token_model_availability` (`token_id`, `model_name`);