CREATE TABLE `project_snapshots` (
	`id` text PRIMARY KEY NOT NULL,
	`project_id` text NOT NULL,
	`source_revision` integer NOT NULL,
	`schema_version` integer NOT NULL,
	`name` text NOT NULL,
	`description` text,
	`payload_json` text NOT NULL,
	`payload_sha256` text NOT NULL,
	`created_at_iso` text NOT NULL,
	`created_by_actor_id` text,
	FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `project_snapshots_project_created_idx` ON `project_snapshots` (`project_id`,`created_at_iso`);--> statement-breakpoint
CREATE UNIQUE INDEX `project_snapshots_project_name_unique` ON `project_snapshots` (`project_id`,`name`);