Переосмысление usecase'ов

This commit is contained in:
Антон
2025-08-20 17:18:35 +03:00
parent 9efa06a9c8
commit b566bb569c
2 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -63,6 +63,7 @@ CREATE TABLE `up_and_down`.`diaries` (
`appetite_level` INT1 NOT NULL,
`dream_level` INT1 NOT NULL,
`anxiety_level` INT1 NOT NULL,
`user_treatment_schemes_guid` CHAR(36),
PRIMARY KEY (`guid`),
FOREIGN KEY (`user_guid`) REFERENCES `users`(`guid`),
FOREIGN KEY (`mania_level`) REFERENCES `mania`(`level`),
@@ -72,7 +73,7 @@ CREATE TABLE `up_and_down`.`diaries` (
FOREIGN KEY (`appetite_level`) REFERENCES `appetites`(`level`),
FOREIGN KEY (`dream_level`) REFERENCES `dreams`(`level`),
FOREIGN KEY (`anxiety_level`) REFERENCES `anxiety`(`level`),
UNIQUE INDEX `guid_UNIQUE` (`guid` ASC)
FOREIGN KEY (`user_treatment_schemes_guid`) REFERENCES `user_treatment_schemes`(`guid`)
);
CREATE TABLE `up_and_down`.`medications` (
@@ -88,7 +89,7 @@ CREATE TABLE `up_and_down`.`treatment_schemes` (
`user_treatment_schemes_guid` CHAR(36) NOT NULL,
`medication_guid` CHAR(36) NOT NULL,
PRIMARY KEY (`user_treatment_schemes_guid`, `medication_guid`),
FOREIGN KEY (`user_treatment_schemes_guid`) REFERENCES `user_treatment_schemes`(`guid`)
FOREIGN KEY (`user_treatment_schemes_guid`) REFERENCES `user_treatment_schemes`(`guid`),
FOREIGN KEY (`medication_guid`) REFERENCES `medications`(`guid`)
);
@@ -97,8 +98,9 @@ CREATE TABLE `up_and_down`.`user_treatment_schemes` (
`user_guid` CHAR(36) NOT NULL,
`treatment_name` TEXT NOT NULL,
`instructions` TEXT,
PRIMARY KEY (`guid`),
FOREIGN KEY (`user_guid`) REFERENCES `users`(`guid`)
)
);
-- insert constants
INSERT INTO `up_and_down`.`mania` (`level`, `description`) VALUES (1, 'Полное отсутствие мании');