mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 02:57:36 +00:00
Latest
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -2,6 +2,7 @@ DELIMITER ;;
|
|||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_RefreshToken_Create`(
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_RefreshToken_Create`(
|
||||||
IN p_id_refresh_token CHAR(36),
|
IN p_id_refresh_token CHAR(36),
|
||||||
IN p_id_user CHAR(36),
|
IN p_id_user CHAR(36),
|
||||||
|
IN p_id_program CHAR(36),
|
||||||
IN p_token_hash VARCHAR(512),
|
IN p_token_hash VARCHAR(512),
|
||||||
IN p_token_salt VARCHAR(512),
|
IN p_token_salt VARCHAR(512),
|
||||||
IN p_expires_in_seconds INT,
|
IN p_expires_in_seconds INT,
|
||||||
@@ -13,6 +14,7 @@ BEGIN
|
|||||||
(
|
(
|
||||||
id_refresh_token,
|
id_refresh_token,
|
||||||
id_user,
|
id_user,
|
||||||
|
id_program,
|
||||||
token_hash,
|
token_hash,
|
||||||
token_salt,
|
token_salt,
|
||||||
expires_at,
|
expires_at,
|
||||||
@@ -23,6 +25,7 @@ BEGIN
|
|||||||
(
|
(
|
||||||
p_id_refresh_token,
|
p_id_refresh_token,
|
||||||
p_id_user,
|
p_id_user,
|
||||||
|
p_id_program,
|
||||||
p_token_hash,
|
p_token_hash,
|
||||||
p_token_salt,
|
p_token_salt,
|
||||||
DATE_ADD(UTC_TIMESTAMP(), INTERVAL p_expires_in_seconds SECOND),
|
DATE_ADD(UTC_TIMESTAMP(), INTERVAL p_expires_in_seconds SECOND),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ CREATE DEFINER=`root`@`%` PROCEDURE `sp_RefreshToken_Replace`(
|
|||||||
IN p_old_token_id CHAR(36),
|
IN p_old_token_id CHAR(36),
|
||||||
IN p_id_refresh_token CHAR(36),
|
IN p_id_refresh_token CHAR(36),
|
||||||
IN p_id_user CHAR(36),
|
IN p_id_user CHAR(36),
|
||||||
|
IN p_id_program CHAR(36),
|
||||||
IN p_token_hash VARCHAR(512),
|
IN p_token_hash VARCHAR(512),
|
||||||
IN p_token_salt VARCHAR(512),
|
IN p_token_salt VARCHAR(512),
|
||||||
IN p_expires_in_seconds INT,
|
IN p_expires_in_seconds INT,
|
||||||
@@ -18,6 +19,7 @@ BEGIN
|
|||||||
(
|
(
|
||||||
id_refresh_token,
|
id_refresh_token,
|
||||||
id_user,
|
id_user,
|
||||||
|
id_program,
|
||||||
token_hash,
|
token_hash,
|
||||||
token_salt,
|
token_salt,
|
||||||
expires_at,
|
expires_at,
|
||||||
@@ -28,6 +30,7 @@ BEGIN
|
|||||||
(
|
(
|
||||||
p_id_refresh_token,
|
p_id_refresh_token,
|
||||||
p_id_user,
|
p_id_user,
|
||||||
|
p_id_program,
|
||||||
p_token_hash,
|
p_token_hash,
|
||||||
p_token_salt,
|
p_token_salt,
|
||||||
DATE_ADD(UTC_TIMESTAMP(), INTERVAL p_expires_in_seconds SECOND),
|
DATE_ADD(UTC_TIMESTAMP(), INTERVAL p_expires_in_seconds SECOND),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ BEGIN
|
|||||||
SELECT
|
SELECT
|
||||||
id_student,
|
id_student,
|
||||||
id_program,
|
id_program,
|
||||||
|
id_user,
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
program_year,
|
||||||
enrollment_date,
|
enrollment_date,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ BEGIN
|
|||||||
SELECT
|
SELECT
|
||||||
id_student,
|
id_student,
|
||||||
id_program,
|
id_program,
|
||||||
|
id_user,
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
program_year,
|
||||||
enrollment_date,
|
enrollment_date,
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ BEGIN
|
|||||||
SELECT
|
SELECT
|
||||||
id_student,
|
id_student,
|
||||||
id_program,
|
id_program,
|
||||||
|
id_user,
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
program_year,
|
||||||
enrollment_date,
|
enrollment_date,
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ BEGIN
|
|||||||
SELECT
|
SELECT
|
||||||
s.id_student,
|
s.id_student,
|
||||||
s.id_program,
|
s.id_program,
|
||||||
|
s.id_user,
|
||||||
s.identifier,
|
s.identifier,
|
||||||
s.program_year,
|
s.program_year,
|
||||||
s.enrollment_date,
|
s.enrollment_date,
|
||||||
s.expected_grad,
|
s.expected_grad,
|
||||||
s.created_at
|
s.created_at
|
||||||
FROM student s
|
FROM student s
|
||||||
JOIN user_student us ON us.id_student = s.id_student
|
WHERE s.id_user = p_id_user
|
||||||
WHERE us.id_user = p_id_user
|
|
||||||
AND s.id_program = p_id_program
|
AND s.id_program = p_id_program
|
||||||
ORDER BY s.id_student;
|
ORDER BY s.id_student;
|
||||||
END;;
|
END;;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ DELIMITER ;;
|
|||||||
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_Insert`(
|
CREATE DEFINER=`root`@`%` PROCEDURE `sp_Student_Insert`(
|
||||||
IN p_id_student CHAR(36),
|
IN p_id_student CHAR(36),
|
||||||
IN p_id_program CHAR(36),
|
IN p_id_program CHAR(36),
|
||||||
|
IN p_id_user CHAR(36),
|
||||||
IN p_identifier VARCHAR(50),
|
IN p_identifier VARCHAR(50),
|
||||||
IN p_program_year INT,
|
IN p_program_year INT,
|
||||||
IN p_enrollment_date DATE,
|
IN p_enrollment_date DATE,
|
||||||
@@ -12,6 +13,7 @@ BEGIN
|
|||||||
(
|
(
|
||||||
id_student,
|
id_student,
|
||||||
id_program,
|
id_program,
|
||||||
|
id_user,
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
program_year,
|
||||||
enrollment_date,
|
enrollment_date,
|
||||||
@@ -22,31 +24,17 @@ BEGIN
|
|||||||
(
|
(
|
||||||
p_id_student,
|
p_id_student,
|
||||||
p_id_program,
|
p_id_program,
|
||||||
|
p_id_user,
|
||||||
p_identifier,
|
p_identifier,
|
||||||
p_program_year,
|
p_program_year,
|
||||||
p_enrollment_date,
|
p_enrollment_date,
|
||||||
p_expected_grad,
|
p_expected_grad,
|
||||||
UTC_TIMESTAMP()
|
UTC_TIMESTAMP()
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO user_student
|
|
||||||
(
|
|
||||||
id_user_student,
|
|
||||||
id_user,
|
|
||||||
id_student,
|
|
||||||
is_primary
|
|
||||||
)
|
|
||||||
VALUES
|
|
||||||
(
|
|
||||||
UUID(),
|
|
||||||
p_id_user,
|
|
||||||
p_id_student,
|
|
||||||
1
|
|
||||||
);
|
|
||||||
|
|
||||||
SELECT
|
SELECT
|
||||||
id_student,
|
id_student,
|
||||||
id_program,
|
id_program,
|
||||||
|
id_user,
|
||||||
identifier,
|
identifier,
|
||||||
program_year,
|
program_year,
|
||||||
enrollment_date,
|
enrollment_date,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
CREATE TABLE `refresh_token` (
|
CREATE TABLE `refresh_token` (
|
||||||
`id_refresh_token` char(36) NOT NULL,
|
`id_refresh_token` char(36) NOT NULL,
|
||||||
`id_user` char(36) NOT NULL,
|
`id_user` char(36) NOT NULL,
|
||||||
|
`id_program` char(36) DEFAULT NULL,
|
||||||
`token_hash` varchar(512) NOT NULL,
|
`token_hash` varchar(512) NOT NULL,
|
||||||
`token_salt` varchar(512) NOT NULL,
|
`token_salt` varchar(512) NOT NULL,
|
||||||
`expires_at` timestamp NOT NULL,
|
`expires_at` timestamp NOT NULL,
|
||||||
@@ -15,6 +16,8 @@ CREATE TABLE `refresh_token` (
|
|||||||
KEY `idx_refresh_token_user` (`id_user`),
|
KEY `idx_refresh_token_user` (`id_user`),
|
||||||
KEY `idx_refresh_token_expires` (`expires_at`),
|
KEY `idx_refresh_token_expires` (`expires_at`),
|
||||||
KEY `refresh_token_ibfk_2` (`replaced_by_token_id`),
|
KEY `refresh_token_ibfk_2` (`replaced_by_token_id`),
|
||||||
|
KEY `fk_refresh_token_program` (`id_program`),
|
||||||
|
CONSTRAINT `fk_refresh_token_program` FOREIGN KEY (`id_program`) REFERENCES `program` (`id_program`),
|
||||||
CONSTRAINT `refresh_token_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`),
|
CONSTRAINT `refresh_token_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`),
|
||||||
CONSTRAINT `refresh_token_ibfk_2` FOREIGN KEY (`replaced_by_token_id`) REFERENCES `refresh_token` (`id_refresh_token`)
|
CONSTRAINT `refresh_token_ibfk_2` FOREIGN KEY (`replaced_by_token_id`) REFERENCES `refresh_token` (`id_refresh_token`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
CREATE TABLE `student` (
|
CREATE TABLE `student` (
|
||||||
`id_student` char(36) NOT NULL,
|
`id_student` char(36) NOT NULL,
|
||||||
`id_program` char(36) DEFAULT NULL,
|
`id_program` char(36) DEFAULT NULL,
|
||||||
|
`id_user` char(36) DEFAULT NULL,
|
||||||
`identifier` varchar(50) DEFAULT NULL,
|
`identifier` varchar(50) DEFAULT NULL,
|
||||||
`program_year` int DEFAULT NULL,
|
`program_year` int DEFAULT NULL,
|
||||||
`enrollment_date` date DEFAULT NULL,
|
`enrollment_date` date DEFAULT NULL,
|
||||||
@@ -8,5 +9,7 @@ CREATE TABLE `student` (
|
|||||||
`created_at` timestamp NULL DEFAULT NULL,
|
`created_at` timestamp NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (`id_student`),
|
PRIMARY KEY (`id_student`),
|
||||||
KEY `student_ibfk_1` (`id_program`),
|
KEY `student_ibfk_1` (`id_program`),
|
||||||
CONSTRAINT `student_ibfk_1` FOREIGN KEY (`id_program`) REFERENCES `program` (`id_program`)
|
KEY `student_ibfk_2` (`id_user`),
|
||||||
|
CONSTRAINT `student_ibfk_1` FOREIGN KEY (`id_program`) REFERENCES `program` (`id_program`),
|
||||||
|
CONSTRAINT `student_ibfk_2` FOREIGN KEY (`id_user`) REFERENCES `user` (`id_user`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ CREATE TABLE `user_student` (
|
|||||||
`id_user_student` char(36) NOT NULL,
|
`id_user_student` char(36) NOT NULL,
|
||||||
`id_user` char(36) DEFAULT NULL,
|
`id_user` char(36) DEFAULT NULL,
|
||||||
`id_student` char(36) DEFAULT NULL,
|
`id_student` char(36) DEFAULT NULL,
|
||||||
`access_level` varchar(50) DEFAULT NULL,
|
|
||||||
`is_primary` tinyint(1) DEFAULT NULL,
|
`is_primary` tinyint(1) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id_user_student`),
|
PRIMARY KEY (`id_user_student`),
|
||||||
KEY `user_student_ibfk_1` (`id_user`),
|
KEY `user_student_ibfk_1` (`id_user`),
|
||||||
|
|||||||
+4
-6
@@ -4,13 +4,11 @@ $mysql = "C:\Program Files\MySQL\MySQL Server 8.4\bin\mysql.exe"
|
|||||||
$baseOutputDir = Join-Path $PSScriptRoot "Objects"
|
$baseOutputDir = Join-Path $PSScriptRoot "Objects"
|
||||||
$database = "winstudentgoaltracker"
|
$database = "winstudentgoaltracker"
|
||||||
|
|
||||||
# Get password once
|
# Password
|
||||||
$securePass = Read-Host "Enter MySQL password" -AsSecureString
|
$pass = "B0I3P0r0ZJzOJWFB"
|
||||||
$pass = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
|
|
||||||
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePass))
|
|
||||||
|
|
||||||
# Connection parameters
|
# Connection parameters
|
||||||
$connParams = @("-h", "10.66.66.1", "-P", "3309", "-u", "root", "-p$pass")
|
$connParams = @("-h", "10.55.55.1", "-P", "3309", "-u", "root", "-p$pass")
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# CONNECTION TEST
|
# CONNECTION TEST
|
||||||
@@ -22,7 +20,7 @@ if ($LASTEXITCODE -ne 0) {
|
|||||||
Write-Host "ERROR: Could not connect to MySQL. Details:" -ForegroundColor Red
|
Write-Host "ERROR: Could not connect to MySQL. Details:" -ForegroundColor Red
|
||||||
Write-Host ($connTest | Out-String).Trim() -ForegroundColor Red
|
Write-Host ($connTest | Out-String).Trim() -ForegroundColor Red
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host "Check your password, host (10.66.66.1), port (3309), and that the MySQL server is reachable." -ForegroundColor Yellow
|
Write-Host "Check your password, host (10.55.55.1), port (3309), and that the MySQL server is reachable." -ForegroundColor Yellow
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
Write-Host "Connection OK." -ForegroundColor Green
|
Write-Host "Connection OK." -ForegroundColor Green
|
||||||
|
|||||||
Reference in New Issue
Block a user