oficina / calendar Public

Clone
git clone https://amadan.net/oficina/calendar

Plain git — no account needed to clone.

Download

Download this file

1ALTER TABLE `people` ADD `handle` text;
2
3CREATE UNIQUE INDEX `idx_people_handle` ON `people`(`handle`);
4
5CREATE TABLE `booking_pages` (`id` integer PRIMARY KEY AUTOINCREMENT,`person_id` integer NOT NULL,`code` text NOT NULL,`title_sealed` blob,`description_sealed` blob,`duration_min` integer NOT NULL,`buffer_min` integer NOT NULL,`notice_min` integer NOT NULL,`horizon_days` integer NOT NULL,`availability_text_sealed` blob,`published_at` integer,`created_at` datetime NOT NULL,`updated_at` datetime NOT NULL);
6
7CREATE UNIQUE INDEX `idx_booking_page_code` ON `booking_pages`(`person_id`,`code`);
8
9CREATE TABLE `booking_windows` (`id` integer PRIMARY KEY AUTOINCREMENT,`page_id` integer NOT NULL,`weekday` integer NOT NULL,`start_min` integer NOT NULL,`end_min` integer NOT NULL);
10
11CREATE INDEX `idx_booking_windows_page_id` ON `booking_windows`(`page_id`);
12
13CREATE TABLE `bookings` (`id` integer PRIMARY KEY AUTOINCREMENT,`page_id` integer NOT NULL,`event_id` integer NOT NULL,`token_hash` text NOT NULL,`token_sealed` blob,`state` text NOT NULL,`title_sealed` blob,`description_sealed` blob,`booker_name_sealed` blob,`booker_address_sealed` blob,`booker_address_fp` text NOT NULL,`note_sealed` blob,`booker_zone` text NOT NULL,`hold_expires_at` integer NOT NULL,`confirmed_at` integer,`cancelled_at` integer,`cancelled_by` text NOT NULL,`ip_fp` text,`ip_forget_at` integer NOT NULL,`reschedules` integer NOT NULL,`created_at` datetime NOT NULL,`updated_at` datetime NOT NULL);
14
15CREATE INDEX `idx_bookings_ip_forget_at` ON `bookings`(`ip_forget_at`);
16
17CREATE INDEX `idx_bookings_ip_fp` ON `bookings`(`ip_fp`);
18
19CREATE INDEX `idx_bookings_hold_expires_at` ON `bookings`(`hold_expires_at`);
20
21CREATE INDEX `idx_bookings_booker_address_fp` ON `bookings`(`booker_address_fp`);
22
23CREATE INDEX `idx_bookings_state` ON `bookings`(`state`);
24
25CREATE UNIQUE INDEX `idx_bookings_token_hash` ON `bookings`(`token_hash`);
26
27CREATE INDEX `idx_bookings_event_id` ON `bookings`(`event_id`);
28
29CREATE INDEX `idx_bookings_page_id` ON `bookings`(`page_id`);
30
31CREATE TABLE `booking_mails` (`id` integer PRIMARY KEY AUTOINCREMENT,`booking_id` integer NOT NULL,`kind` text NOT NULL,`recipient` text NOT NULL,`revision` integer NOT NULL,`due_at` integer NOT NULL,`attempts` integer NOT NULL,`claimed_at` integer,`claim_id` text NOT NULL,`sent_at` integer,`created_at` datetime NOT NULL);
32
33CREATE INDEX `idx_booking_mails_due_at` ON `booking_mails`(`due_at`);
34
35CREATE UNIQUE INDEX `idx_booking_mail_once` ON `booking_mails`(`booking_id`,`kind`,`recipient`,`revision`);
36
37