mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 02:57:36 +00:00
Edit button locate, delete, group header
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Benchmark_Delete`(IN p_id_benchmark CHAR(36))
|
||||
BEGIN
|
||||
-- Remove progress-event/benchmark associations
|
||||
DELETE FROM progress_event_benchmark
|
||||
WHERE id_benchmark = p_id_benchmark;
|
||||
-- Remove the benchmark itself
|
||||
DELETE FROM benchmark
|
||||
WHERE id_benchmark = p_id_benchmark;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
@@ -0,0 +1,22 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Goal_Delete`(IN p_id_goal CHAR(36))
|
||||
BEGIN
|
||||
-- Remove benchmark/event associations for progress events under this goal
|
||||
DELETE peb FROM progress_event_benchmark peb
|
||||
INNER JOIN progress_event pe ON pe.id_progress_event = peb.id_progress_event
|
||||
WHERE pe.id_goal = p_id_goal;
|
||||
-- Remove progress events under this goal
|
||||
DELETE FROM progress_event
|
||||
WHERE id_goal = p_id_goal;
|
||||
-- Remove benchmarks under this goal
|
||||
DELETE FROM benchmark
|
||||
WHERE id_goal = p_id_goal;
|
||||
-- Remove child goals (one level)
|
||||
DELETE FROM goal
|
||||
WHERE id_goal_parent = p_id_goal;
|
||||
-- Remove the goal itself
|
||||
DELETE FROM goal
|
||||
WHERE id_goal = p_id_goal;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
@@ -0,0 +1,12 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ProgressEvent_Delete`(IN p_id_progress_event CHAR(36))
|
||||
BEGIN
|
||||
-- Remove benchmark associations
|
||||
DELETE FROM progress_event_benchmark
|
||||
WHERE id_progress_event = p_id_progress_event;
|
||||
-- Remove the progress event itself
|
||||
DELETE FROM progress_event
|
||||
WHERE id_progress_event = p_id_progress_event;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
@@ -4,7 +4,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_Delete`(
|
||||
)
|
||||
BEGIN
|
||||
DELETE FROM `ReportPrompt`
|
||||
WHERE `id_report_prompt` = p_id_report_prompt;
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt;
|
||||
SELECT ROW_COUNT() AS rowsAffected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -2,7 +2,7 @@ DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_GetAll`()
|
||||
BEGIN
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
|
||||
@@ -4,12 +4,12 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_GetById`(
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
FROM `ReportPrompt`
|
||||
WHERE `id_report_prompt` = p_id_report_prompt
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt
|
||||
LIMIT 1;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -5,7 +5,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_GetByReportname`(
|
||||
)
|
||||
BEGIN
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
|
||||
@@ -8,7 +8,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_Insert`(
|
||||
BEGIN
|
||||
INSERT INTO `ReportPrompt`
|
||||
(
|
||||
`id_report_prompt`,
|
||||
`id_ReportPrompt`,
|
||||
`id_program`,
|
||||
`prompt`,
|
||||
`reportname`
|
||||
@@ -21,12 +21,12 @@ BEGIN
|
||||
p_reportname
|
||||
);
|
||||
SELECT
|
||||
`id_report_prompt` AS `reportPromptId`,
|
||||
`id_ReportPrompt` AS `reportPromptId`,
|
||||
`id_program` AS `programId`,
|
||||
`prompt` AS `prompt`,
|
||||
`reportname` AS `reportname`
|
||||
FROM `ReportPrompt`
|
||||
WHERE `id_report_prompt` = p_id_report_prompt
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt
|
||||
LIMIT 1;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -7,9 +7,9 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_ReportPrompt_Update`(
|
||||
BEGIN
|
||||
UPDATE `ReportPrompt`
|
||||
SET
|
||||
`prompt` = p_prompt,
|
||||
`reportname` = p_reportname
|
||||
WHERE `id_report_prompt` = p_id_report_prompt;
|
||||
`prompt` = COALESCE(p_prompt, `prompt`),
|
||||
`reportname` = COALESCE(p_reportname, `reportname`)
|
||||
WHERE `id_ReportPrompt` = p_id_report_prompt;
|
||||
SELECT ROW_COUNT() AS rowsAffected;
|
||||
END;;
|
||||
DELIMITER ;
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
DELIMITER ;;
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_Delete`(IN p_id_student CHAR(36))
|
||||
BEGIN
|
||||
-- Remove progress-event/benchmark associations
|
||||
DELETE peb FROM progress_event_benchmark peb
|
||||
INNER JOIN progress_event pe ON pe.id_progress_event = peb.id_progress_event
|
||||
INNER JOIN goal g ON g.id_goal = pe.id_goal
|
||||
WHERE g.id_student = p_id_student;
|
||||
-- Remove progress events
|
||||
DELETE pe FROM progress_event pe
|
||||
INNER JOIN goal g ON g.id_goal = pe.id_goal
|
||||
WHERE g.id_student = p_id_student;
|
||||
-- Remove benchmarks
|
||||
DELETE b FROM benchmark b
|
||||
INNER JOIN goal g ON g.id_goal = b.id_goal
|
||||
WHERE g.id_student = p_id_student;
|
||||
-- Remove goals
|
||||
DELETE FROM goal
|
||||
WHERE id_student = p_id_student;
|
||||
-- Remove user-student associations
|
||||
DELETE FROM user_student
|
||||
WHERE id_student = p_id_student;
|
||||
-- Remove the student
|
||||
DELETE FROM student
|
||||
WHERE id_student = p_id_student;
|
||||
SELECT ROW_COUNT() AS rows_affected;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
CREATE TABLE `school_district` (
|
||||
`id_school_district` char(36) NOT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`contact_email` varchar(255) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id_school_district`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
@@ -1,12 +0,0 @@
|
||||
CREATE TABLE `student` (
|
||||
`id_student` char(36) NOT NULL,
|
||||
`id_program` char(36) DEFAULT NULL,
|
||||
`identifier` varchar(50) DEFAULT NULL,
|
||||
`program_year` int DEFAULT NULL,
|
||||
`enrollment_date` date DEFAULT NULL,
|
||||
`next_iep_date` date DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id_student`),
|
||||
KEY `student_ibfk_1` (`id_program`),
|
||||
CONSTRAINT `student_ibfk_1` FOREIGN KEY (`id_program`) REFERENCES `program` (`id_program`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
@@ -1,12 +0,0 @@
|
||||
CREATE TABLE `user` (
|
||||
`id_user` char(36) NOT NULL,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`password_hash` varchar(255) DEFAULT NULL,
|
||||
`password_salt` varchar(255) DEFAULT NULL,
|
||||
`password_updated_at` timestamp NULL DEFAULT NULL,
|
||||
`failed_login_attempts` int DEFAULT '0',
|
||||
`locked_until` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
@@ -1,16 +0,0 @@
|
||||
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_3` FOREIGN KEY (`id_role`) REFERENCES `role` (`id_role`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
@@ -1,11 +0,0 @@
|
||||
CREATE TABLE `user_student` (
|
||||
`id_user_student` char(36) NOT NULL,
|
||||
`id_user` char(36) DEFAULT NULL,
|
||||
`id_student` char(36) DEFAULT NULL,
|
||||
`is_primary` tinyint(1) DEFAULT NULL,
|
||||
PRIMARY KEY (`id_user_student`),
|
||||
KEY `user_student_ibfk_1` (`id_user`),
|
||||
KEY `user_student_ibfk_2` (`id_student`),
|
||||
CONSTRAINT `user_student_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`),
|
||||
CONSTRAINT `user_student_ibfk_2` FOREIGN KEY (`id_student`) REFERENCES `student` (`id_student`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
Reference in New Issue
Block a user