mirror of
https://github.com/apotdevin/thunderhub.git
synced 2026-08-13 12:33:08 +02:00
19 lines
772 B
MySQL
19 lines
772 B
MySQL
|
|
CREATE TABLE `teams` (
|
||
|
|
`id` text PRIMARY KEY NOT NULL,
|
||
|
|
`name` text NOT NULL,
|
||
|
|
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
|
||
|
|
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
|
||
|
|
);
|
||
|
|
--> statement-breakpoint
|
||
|
|
CREATE TABLE `users` (
|
||
|
|
`id` text PRIMARY KEY NOT NULL,
|
||
|
|
`email` text NOT NULL,
|
||
|
|
`password_hash` text NOT NULL,
|
||
|
|
`role` text DEFAULT 'member' NOT NULL,
|
||
|
|
`team_id` text NOT NULL,
|
||
|
|
`created_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
|
||
|
|
`updated_at` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
|
||
|
|
FOREIGN KEY (`team_id`) REFERENCES `teams`(`id`) ON UPDATE no action ON DELETE no action
|
||
|
|
);
|
||
|
|
--> statement-breakpoint
|
||
|
|
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);
|