CREATE TABLE `printJob` (
	`id` text PRIMARY KEY NOT NULL,
	`printerId` text NOT NULL,
	`userId` text NOT NULL,
	`startAt` integer NOT NULL,
	`durationInMinutes` integer NOT NULL,
	`comments` text,
	`aborted` integer DEFAULT false NOT NULL,
	`abortReason` text,
	FOREIGN KEY (`printerId`) REFERENCES `printer`(`id`) ON UPDATE no action ON DELETE cascade,
	FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `printer` (
	`id` text PRIMARY KEY NOT NULL,
	`name` text NOT NULL,
	`description` text NOT NULL,
	`status` integer DEFAULT 0 NOT NULL
);
--> statement-breakpoint
CREATE TABLE `session` (
	`id` text PRIMARY KEY NOT NULL,
	`user_id` text NOT NULL,
	`expires_at` integer NOT NULL,
	FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `user` (
	`id` text PRIMARY KEY NOT NULL,
	`github_id` integer NOT NULL,
	`name` text,
	`displayName` text,
	`email` text NOT NULL,
	`role` text DEFAULT 'guest'
);
