mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 15:47:35 +00:00
Database updates
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
CREATE TABLE `user` (
|
||||
`id_user` char(36) NOT NULL,
|
||||
`id_role` char(36) DEFAULT NULL,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`password_hash` varchar(255) DEFAULT NULL,
|
||||
@@ -9,7 +8,5 @@ CREATE TABLE `user` (
|
||||
`failed_login_attempts` int DEFAULT '0',
|
||||
`locked_until` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id_user`),
|
||||
KEY `user_ibfk_1` (`id_role`),
|
||||
CONSTRAINT `user_ibfk_1` FOREIGN KEY (`id_role`) REFERENCES `role` (`id_role`)
|
||||
PRIMARY KEY (`id_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
@@ -2,12 +2,15 @@ CREATE TABLE `user_program` (
|
||||
`id_user_program` char(36) NOT NULL,
|
||||
`id_user` char(36) DEFAULT NULL,
|
||||
`id_program` char(36) DEFAULT NULL,
|
||||
`id_role` char(36) DEFAULT NULL,
|
||||
`is_primary` tinyint(1) DEFAULT '0',
|
||||
`status` varchar(20) DEFAULT 'active',
|
||||
`joined_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id_user_program`),
|
||||
UNIQUE KEY `uq_user_program` (`id_user`,`id_program`),
|
||||
KEY `idx_id_program` (`id_program`),
|
||||
KEY `idx_user_program_role` (`id_role`),
|
||||
CONSTRAINT `user_program_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`),
|
||||
CONSTRAINT `user_program_ibfk_2` FOREIGN KEY (`id_program`) REFERENCES `program` (`id_program`)
|
||||
CONSTRAINT `user_program_ibfk_2` FOREIGN KEY (`id_program`) REFERENCES `program` (`id_program`),
|
||||
CONSTRAINT `user_program_ibfk_3` FOREIGN KEY (`id_role`) REFERENCES `role` (`id_role`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
Reference in New Issue
Block a user