mirror of
https://github.com/Lapikud/tipilan.git
synced 2026-03-23 21:34:21 +00:00
bun --bun run dev + haldus leht init
This commit is contained in:
43
migrations/0000_awesome_wendigo.sql
Normal file
43
migrations/0000_awesome_wendigo.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
CREATE TABLE `member` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`user_id` text NOT NULL,
|
||||
`team_id` text,
|
||||
`role` text NOT NULL,
|
||||
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
FOREIGN KEY (`team_id`) REFERENCES `team`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_team_unique` ON `member` (`user_id`,`team_id`);--> statement-breakpoint
|
||||
CREATE TABLE `team` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`name` text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `tournament_team` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`tournament_id` text NOT NULL,
|
||||
`team_id` text NOT NULL,
|
||||
`registration_date` integer NOT NULL,
|
||||
FOREIGN KEY (`tournament_id`) REFERENCES `tournament`(`id`) ON UPDATE no action ON DELETE cascade,
|
||||
FOREIGN KEY (`team_id`) REFERENCES `team`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `tournament_team_unique` ON `tournament_team` (`tournament_id`,`team_id`);--> statement-breakpoint
|
||||
CREATE TABLE `tournament` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`name` text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `user` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`email` text NOT NULL,
|
||||
`steam_id` text,
|
||||
`first_name` text NOT NULL,
|
||||
`last_name` text NOT NULL,
|
||||
`ticket_id` text,
|
||||
`ticket_type` text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_steam_id_unique` ON `user` (`steam_id`);--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `user_ticket_id_unique` ON `user` (`ticket_id`);
|
||||
Reference in New Issue
Block a user