diff --git a/docs/design/README.md b/docs/design/README.md index ab53e23..0653d7f 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -115,3 +115,6 @@ Responce "0,*" --> "0,1" Account @enduml + +## Реляційна схема +![relational_schema](./relational_scheme.png) \ No newline at end of file diff --git a/docs/design/relational_scheme.png b/docs/design/relational_scheme.png new file mode 100644 index 0000000..0df6288 Binary files /dev/null and b/docs/design/relational_scheme.png differ diff --git a/docs/software/README.md b/docs/software/README.md index 2362239..bef4c7c 100644 --- a/docs/software/README.md +++ b/docs/software/README.md @@ -1,3 +1,113 @@ # Реалізація інформаційного та програмного забезпечення +## SQL-скрипт для створення та початкового наповнення бази даних +```sql +-- MySQL Workbench Forward Engineering + +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; + +-- ----------------------------------------------------- +-- Schema mydb +-- ----------------------------------------------------- + +-- ----------------------------------------------------- +-- Schema mydb +-- ----------------------------------------------------- +CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ; +USE `mydb` ; + +-- ----------------------------------------------------- +-- Table `mydb`.`Account` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Account` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `username` CHAR(255) NOT NULL, + `password` CHAR(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + UNIQUE INDEX `username_UNIQUE` (`username` ASC) VISIBLE) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Survey` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Survey` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `isPaused` TINYINT UNSIGNED NOT NULL, + `isNamed` TINYINT UNSIGNED NOT NULL, + `name` CHAR(255) NULL, + `duration` CHAR(255) NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + CONSTRAINT `fk_Survey_Account1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Account` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Question` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Question` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `Text` CHAR(255) NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + CONSTRAINT `fk_Question_Survey1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Survey` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Response` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Response` ( + `id` INT UNSIGNED NULL AUTO_INCREMENT, + `Value` VARCHAR(16384) NULL, + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + PRIMARY KEY (`id`), + CONSTRAINT `fk_Response_Question` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Question` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Response_Account1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Account` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Link` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Link` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `uses` INT NOT NULL, + `responces` INT NOT NULL, + `usageLimit` INT NULL, + `responceLimit` INT NULL, + `path` CHAR(32) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_Link_Survey1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Survey` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; +``` \ No newline at end of file diff --git a/src/1.js b/src/js/1.js similarity index 100% rename from src/1.js rename to src/js/1.js diff --git a/src/README.md b/src/js/README.md similarity index 59% rename from src/README.md rename to src/js/README.md index a4c4058..5eb1265 100644 --- a/src/README.md +++ b/src/js/README.md @@ -1,2 +1,3 @@ -# програмні коди -В цьому розділі розміщені програмні коди. +# JS-скрипти + +В цьому розділі розміщені програмні коди javascript. \ No newline at end of file diff --git a/src/sql/README.md b/src/sql/README.md new file mode 100644 index 0000000..6f1f698 --- /dev/null +++ b/src/sql/README.md @@ -0,0 +1,3 @@ +# SQL-скрипти + +В цьому розділі розміщені сирцеві коди для створення бази даних. \ No newline at end of file diff --git a/src/sql/script.sql b/src/sql/script.sql new file mode 100644 index 0000000..70d2673 --- /dev/null +++ b/src/sql/script.sql @@ -0,0 +1,107 @@ +-- MySQL Workbench Forward Engineering + +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; + +-- ----------------------------------------------------- +-- Schema mydb +-- ----------------------------------------------------- + +-- ----------------------------------------------------- +-- Schema mydb +-- ----------------------------------------------------- +CREATE SCHEMA IF NOT EXISTS `mydb` DEFAULT CHARACTER SET utf8 ; +USE `mydb` ; + +-- ----------------------------------------------------- +-- Table `mydb`.`Account` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Account` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `username` CHAR(255) NOT NULL, + `password` CHAR(255) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + UNIQUE INDEX `username_UNIQUE` (`username` ASC) VISIBLE) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Survey` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Survey` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `isPaused` TINYINT UNSIGNED NOT NULL, + `isNamed` TINYINT UNSIGNED NOT NULL, + `name` CHAR(255) NULL, + `duration` CHAR(255) NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + CONSTRAINT `fk_Survey_Account1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Account` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Question` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Question` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `Text` CHAR(255) NULL, + PRIMARY KEY (`id`), + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + CONSTRAINT `fk_Question_Survey1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Survey` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Response` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Response` ( + `id` INT UNSIGNED NULL AUTO_INCREMENT, + `Value` VARCHAR(16384) NULL, + UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE, + PRIMARY KEY (`id`), + CONSTRAINT `fk_Response_Question` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Question` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Response_Account1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Account` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `mydb`.`Link` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `mydb`.`Link` ( + `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, + `uses` INT NOT NULL, + `responces` INT NOT NULL, + `usageLimit` INT NULL, + `responceLimit` INT NULL, + `path` CHAR(32) NOT NULL, + PRIMARY KEY (`id`), + CONSTRAINT `fk_Link_Survey1` + FOREIGN KEY (`id`) + REFERENCES `mydb`.`Survey` (`id`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;