Skip to content

Open source alternative to Semrush and Ahrefs

1.4 KB
Raw Blame
CREATE TABLE `reports` (
	`id` text PRIMARY KEY NOT NULL,
	`project_id` text NOT NULL,
	`title` text NOT NULL,
	`summary` text NOT NULL,
	`html` text NOT NULL,
	`skill` text,
	`template_id` text,
	`created_by` text NOT NULL,
	`created_by_user_id` text NOT NULL,
	`size_bytes` integer NOT NULL,
	`share_token` text,
	`shared_at` text,
	`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,
	FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `reports_project_updated_idx` ON `reports` (`project_id`,`updated_at`,`id`,`size_bytes`);--> statement-breakpoint
CREATE UNIQUE INDEX `reports_share_token_idx` ON `reports` (`share_token`);--> statement-breakpoint
CREATE TABLE `report_templates` (
	`id` text PRIMARY KEY NOT NULL,
	`project_id` text NOT NULL,
	`name` text NOT NULL,
	`description` text NOT NULL,
	`instructions` text NOT NULL,
	`created_by` text NOT NULL,
	`created_by_user_id` text 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,
	FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `report_templates_project_name_idx` ON `report_templates` (`project_id`,`name`);