| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- CREATE TABLE `bot_api_keys` (
- `id` text PRIMARY KEY NOT NULL,
- `name` text NOT NULL,
- `key_hash` text NOT NULL,
- `key_prefix` text NOT NULL,
- `enabled` integer DEFAULT true NOT NULL,
- `allowed_bot_ids` text DEFAULT '[]' NOT NULL,
- `created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL,
- `last_used_at` text
- );
- --> statement-breakpoint
- CREATE UNIQUE INDEX `bot_api_keys_key_hash_unique` ON `bot_api_keys` (`key_hash`);--> statement-breakpoint
- CREATE TABLE `bots` (
- `id` text PRIMARY KEY NOT NULL,
- `name` text NOT NULL,
- `avatar` text DEFAULT '🤖' NOT NULL,
- `kind` text NOT NULL,
- `description` text DEFAULT '' NOT NULL,
- `profile_id` text NOT NULL,
- `enabled` integer DEFAULT true NOT NULL,
- `created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL,
- `updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL
- );
- --> statement-breakpoint
- CREATE UNIQUE INDEX `bots_name_unique` ON `bots` (`name`);--> statement-breakpoint
- CREATE TABLE `team_bot_sessions` (
- `team_id` text NOT NULL,
- `bot_id` text NOT NULL,
- `session_id` text NOT NULL,
- `last_read_seq` integer DEFAULT 0 NOT NULL,
- PRIMARY KEY(`team_id`, `bot_id`)
- );
- --> statement-breakpoint
- CREATE UNIQUE INDEX `team_bot_sessions_session_id_unique` ON `team_bot_sessions` (`session_id`);--> statement-breakpoint
- CREATE TABLE `team_bots` (
- `team_id` text NOT NULL,
- `bot_id` text NOT NULL,
- `role` text NOT NULL,
- `joined_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL,
- PRIMARY KEY(`team_id`, `bot_id`)
- );
- --> statement-breakpoint
- CREATE INDEX `team_bots_bot_idx` ON `team_bots` (`bot_id`);--> statement-breakpoint
- CREATE TABLE `team_events` (
- `team_id` text NOT NULL,
- `seq` integer NOT NULL,
- `type` text NOT NULL,
- `payload` text NOT NULL,
- `ts` text NOT NULL,
- PRIMARY KEY(`team_id`, `seq`)
- );
- --> statement-breakpoint
- CREATE TABLE `teams` (
- `id` text PRIMARY KEY NOT NULL,
- `source` text NOT NULL,
- `title` text DEFAULT '' NOT NULL,
- `human` text NOT NULL,
- `status` text DEFAULT 'active' NOT NULL,
- `workspace_dir` text NOT NULL,
- `last_seq` integer DEFAULT 0 NOT NULL,
- `created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL,
- `updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ','now')) NOT NULL
- );
- --> statement-breakpoint
- CREATE INDEX `teams_source_idx` ON `teams` (`source`,`updated_at`);
|