Your favorite shift management application!
CREATE TABLE `calendars` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`color` text DEFAULT '#3b82f6' NOT NULL,
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE TABLE `shift_presets` (
`id` text PRIMARY KEY NOT NULL,
`calendar_id` text NOT NULL,
`title` text NOT NULL,
`start_time` text NOT NULL,
`end_time` text NOT NULL,
`color` text DEFAULT '#3b82f6' NOT NULL,
`notes` text,
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (`calendar_id`) REFERENCES `calendars`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `shifts` (
`id` text PRIMARY KEY NOT NULL,
`calendar_id` text NOT NULL,
`preset_id` text,
`date` integer NOT NULL,
`start_time` text NOT NULL,
`end_time` text NOT NULL,
`title` text NOT NULL,
`color` text DEFAULT '#3b82f6' NOT NULL,
`notes` text,
`created_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_at` integer DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY (`calendar_id`) REFERENCES `calendars`(`id`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (`preset_id`) REFERENCES `shift_presets`(`id`) ON UPDATE no action ON DELETE set null
);