peppa/packages/db/migrations/0011_project_secrets.sql
Асель 9149c75840 PEP-19/54: project secrets for agents, secrets audit and two-key PEPPA_SECRET rotation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 07:19:57 +05:00

16 lines
811 B
SQL

CREATE TABLE `project_secrets` (
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
`project_id` integer NOT NULL,
`name` text NOT NULL,
`value_enc` text NOT NULL,
`created_by` integer,
`updated_by` integer,
`created_at` integer DEFAULT (cast(unixepoch('subsec') * 1000 as integer)) NOT NULL,
`updated_at` integer DEFAULT (cast(unixepoch('subsec') * 1000 as integer)) NOT NULL,
`last_used_at` integer,
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null,
FOREIGN KEY (`updated_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
);
--> statement-breakpoint
CREATE UNIQUE INDEX `project_secrets_project_name` ON `project_secrets` (`project_id`,`name`);