first working demo
This commit is contained in:
64
drizzle/0000_perfect_night_nurse.sql
Normal file
64
drizzle/0000_perfect_night_nurse.sql
Normal file
@@ -0,0 +1,64 @@
|
||||
CREATE TABLE `audio_file` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`filename` text NOT NULL,
|
||||
`content_type` text NOT NULL,
|
||||
`data` blob NOT NULL,
|
||||
`duration` real,
|
||||
`created_at` integer NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `invite_link` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`token` text NOT NULL,
|
||||
`participant_name` text,
|
||||
`is_used` integer DEFAULT false NOT NULL,
|
||||
`created_at` integer NOT NULL,
|
||||
`used_at` integer
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `invite_link_token_unique` ON `invite_link` (`token`);--> statement-breakpoint
|
||||
CREATE TABLE `participant` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`invite_token` text NOT NULL,
|
||||
`session_id` text,
|
||||
`created_at` integer NOT NULL,
|
||||
FOREIGN KEY (`invite_token`) REFERENCES `invite_link`(`token`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `participant_progress` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`participant_id` text NOT NULL,
|
||||
`audio_file_id` text NOT NULL,
|
||||
`is_completed` integer DEFAULT false NOT NULL,
|
||||
`last_position` real DEFAULT 0,
|
||||
`updated_at` integer NOT NULL,
|
||||
FOREIGN KEY (`participant_id`) REFERENCES `participant`(`id`) ON UPDATE no action ON DELETE no action,
|
||||
FOREIGN KEY (`audio_file_id`) REFERENCES `audio_file`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `rating` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`participant_id` text NOT NULL,
|
||||
`audio_file_id` text NOT NULL,
|
||||
`timestamp` real NOT NULL,
|
||||
`value` real NOT NULL,
|
||||
`created_at` integer NOT NULL,
|
||||
FOREIGN KEY (`participant_id`) REFERENCES `participant`(`id`) ON UPDATE no action ON DELETE no action,
|
||||
FOREIGN KEY (`audio_file_id`) REFERENCES `audio_file`(`id`) ON UPDATE no action ON DELETE no action
|
||||
);
|
||||
--> 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 no action
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `user` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`age` integer,
|
||||
`username` text NOT NULL,
|
||||
`password_hash` text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`);
|
||||
Reference in New Issue
Block a user