CREATE TABLE `cache` (
	`key` text PRIMARY KEY NOT NULL,
	`value` text DEFAULT '{}' NOT NULL,
	`namespace` text NOT NULL,
	`ttl` integer,
	`created_at` text NOT NULL,
	`updated_at` text NOT NULL
);
--> statement-breakpoint
CREATE INDEX `idx_cache_namespace` ON `cache` (`namespace`);--> statement-breakpoint
CREATE INDEX `idx_cache_key_namespace` ON `cache` (`key`,`namespace`);--> statement-breakpoint
CREATE TABLE `file_hashes` (
	`id` text PRIMARY KEY NOT NULL,
	`file_type` text NOT NULL,
	`file_path` text NOT NULL,
	`hash` text NOT NULL,
	`status` text DEFAULT 'upToDate' NOT NULL,
	`created_at` text NOT NULL,
	`updated_at` text NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `idx_file_hashes_type_path` ON `file_hashes` (`file_type`,`file_path`);--> statement-breakpoint
CREATE INDEX `idx_file_hashes_type_hash` ON `file_hashes` (`file_type`,`hash`);--> statement-breakpoint
CREATE TABLE `scorecards_config` (
	`id` text PRIMARY KEY NOT NULL,
	`key` text NOT NULL,
	`slug` text NOT NULL,
	`name` text NOT NULL,
	`description` text,
	`entities_filter` text NOT NULL,
	`levels` text NOT NULL,
	`config_hash` text NOT NULL,
	`archived_at` text,
	`created_at` text NOT NULL,
	`updated_at` text NOT NULL
);
--> statement-breakpoint
CREATE INDEX `idx_config_key` ON `scorecards_config` (`key`);--> statement-breakpoint
CREATE INDEX `idx_config_slug` ON `scorecards_config` (`slug`);--> statement-breakpoint
CREATE INDEX `idx_config_hash` ON `scorecards_config` (`config_hash`);--> statement-breakpoint
CREATE INDEX `idx_config_archived` ON `scorecards_config` (`archived_at`);