Compare commits
	
		
			3 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3bc9d4ed84 | |||
| 1110eee18e | |||
| 59f249f4ea | 
@ -15,7 +15,7 @@ module.exports = {
 | 
			
		||||
    }]
 | 
			
		||||
  ],
 | 
			
		||||
  port: 3030,
 | 
			
		||||
  base: '/edu-dis-labs/',
 | 
			
		||||
  base: '/OBD-lab6/',
 | 
			
		||||
  theme: 'cool',
 | 
			
		||||
  // dest: 'dist',
 | 
			
		||||
  head: [
 | 
			
		||||
@ -66,12 +66,6 @@ module.exports = {
 | 
			
		||||
      title: 'Висновки',
 | 
			
		||||
      path:"/conclusion/"
 | 
			
		||||
    },
 | 
			
		||||
    
 | 
			
		||||
    {
 | 
			
		||||
      title: 'API',
 | 
			
		||||
      path:"/api/"
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  ],
 | 
			
		||||
    sidebarDepth: 2,
 | 
			
		||||
    displayAllHeaders: true, // Default: false
 | 
			
		||||
 | 
			
		||||
@ -6,23 +6,12 @@ actionLink: /intro/
 | 
			
		||||
footer: "ECL 2.0 Licensed | Copyright © 2024 [Your Name]"
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
**Виконали:** 
 | 
			
		||||
**Виконав:** 
 | 
			
		||||
 | 
			
		||||
*студенти 2-го курсу, групи ІО-23:*
 | 
			
		||||
 | 
			
		||||
*Олег ШМУЛЯР [shmuliar1@ukr.net, [@dmytrofiot23](https://t.me/dmytrofiot23)]*
 | 
			
		||||
 | 
			
		||||
*Андрій БОДНАР [bodnarandrew123@gmail.com, [@andrux4](https://t.me/andrux4)]*
 | 
			
		||||
 | 
			
		||||
*Андрій ШВЕД [andreyfrog26@gmail.com, [@Rhinemann](https://t.me/Rhinemann)]*
 | 
			
		||||
*студент 2-го курсу, групи ІО-23:*
 | 
			
		||||
 | 
			
		||||
*Євгеній ГОЛОВАТЕНКО [ievgeniigol@gmail.com, [@yevholova](https://t.me/yevholova)]*
 | 
			
		||||
 | 
			
		||||
*Вікторія ВОДЯНА [vodyanayaviktoria@gmail.com, [@victoriavodyana](https://t.me/victoriavodyana)]*
 | 
			
		||||
 | 
			
		||||
*Михайло КОРБУТ [korbutmykhailo@gmail.com, [@misha1tigr](https://t.me/misha1tigr)]*
 | 
			
		||||
 | 
			
		||||
*Олександр ГУРАНЕЦЬ [bacant150@gmail.com, [@Bacant150](https://t.me/Bacant150)]*
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
**Керівник**
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,5 @@
 | 
			
		||||
# Висновки
 | 
			
		||||
 | 
			
		||||
У висновках наводять оцінку отриманих результатів, можливі галузі його використання. Висновки повинні містити в собі коротку узагальнену оцінку результатів розробки, у
 | 
			
		||||
тому числі і з погляду на їх технічно-економічну ефективність. Необхідно порівняти
 | 
			
		||||
отримані результати усіх характеристик об’єкта проєктування із завданням і з основними показниками сучасних аналогічних об’єктів.
 | 
			
		||||
 | 
			
		||||
Необхідно вказати яке нове технічне рішення покладене в основу проєкту і у чому її
 | 
			
		||||
переваги, що нового було запропоновано самим студентом. 
 | 
			
		||||
 | 
			
		||||
На базі отриманих висновків можуть надаватися рекомендації по використанню розробки. Вони повинні
 | 
			
		||||
мати конкретний характер і бути цілком підтверджені проєктом.
 | 
			
		||||
Підсумовуючи, можу сказати, що розроблений мною RESTfull-сервіс працює коректно та має деякі особливості, зокрема й повернення статусу запиту окремим параметром в JSON-документі. Такі дрібниці спрощують роботу розробникам, що використовуватимуть мою систему, а це завжди є перевагою.
 | 
			
		||||
 | 
			
		||||
Крім того, завдяки простій та зрозумілій організації даних в БД цю систему можна швидко розгорнути на серверах, а її структура дозволить додавати в проєкт нову функціональність, тому цей проєкт має потенціал стати базою для подальших розробок.
 | 
			
		||||
 | 
			
		||||
@ -110,4 +110,147 @@ ENGINE = InnoDB;
 | 
			
		||||
SET SQL_MODE=@OLD_SQL_MODE;
 | 
			
		||||
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
 | 
			
		||||
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
 | 
			
		||||
```
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Програмний код RESTful-сервісу
 | 
			
		||||
 | 
			
		||||
```python
 | 
			
		||||
from flask import Flask, request, jsonify
 | 
			
		||||
import mysql.connector
 | 
			
		||||
from mysql.connector import Error
 | 
			
		||||
from db_config import db_config
 | 
			
		||||
 | 
			
		||||
app = Flask(name)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_db_connection():
 | 
			
		||||
    try:
 | 
			
		||||
        conn = mysql.connector.connect(**db_config)
 | 
			
		||||
        return conn
 | 
			
		||||
    except Error as e:
 | 
			
		||||
        return jsonify({"error": f"Error in connection to database: {str(e)}"}), 500
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route('/links', methods=['GET'])
 | 
			
		||||
def get_links():
 | 
			
		||||
    try:
 | 
			
		||||
        conn = get_db_connection()
 | 
			
		||||
        if isinstance(conn, tuple):
 | 
			
		||||
            return conn
 | 
			
		||||
        cursor = conn.cursor(dictionary=True)
 | 
			
		||||
        cursor.execute('SELECT * FROM link')
 | 
			
		||||
        links = cursor.fetchall()
 | 
			
		||||
        cursor.close()
 | 
			
		||||
        conn.close()
 | 
			
		||||
        return jsonify(links)
 | 
			
		||||
    except Error as e:
 | 
			
		||||
        return jsonify({"error": f"Error getting data: {str(e)}"}), 500
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route('/link/<int:id>', methods=['GET'])
 | 
			
		||||
def get_link():
 | 
			
		||||
    try:
 | 
			
		||||
        conn = get_db_connection()
 | 
			
		||||
        if isinstance(conn, tuple):
 | 
			
		||||
            return conn
 | 
			
		||||
        cursor = conn.cursor(dictionary=True)
 | 
			
		||||
        cursor.execute('SELECT * FROM link WHERE id = %s', [1])
 | 
			
		||||
        link = cursor.fetchone()
 | 
			
		||||
        cursor.close()
 | 
			
		||||
        conn.close()
 | 
			
		||||
        if link is None:
 | 
			
		||||
            return jsonify({"error": "Link is not found"}), 404
 | 
			
		||||
        return jsonify(link)
 | 
			
		||||
    except Error as e:
 | 
			
		||||
        return jsonify({"error": f"Error getting data: {str(e)}"}), 500
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route('/link', methods=['POST'])
 | 
			
		||||
def create_link():
 | 
			
		||||
    try:
 | 
			
		||||
        new_link = request.json
 | 
			
		||||
        conn = get_db_connection()
 | 
			
		||||
        if isinstance(conn, tuple):
 | 
			
		||||
            return conn
 | 
			
		||||
        cursor = conn.cursor()
 | 
			
		||||
 | 
			
		||||
        cursor.execute('''
 | 
			
		||||
            INSERT INTO link (uses, responses, usageLimit, responseLimit, path, Survey_id) 
 | 
			
		||||
            VALUES (%s, %s, %s, %s, %s, %s)
 | 
			
		||||
        ''', (
 | 
			
		||||
            new_link.get('uses'),
 | 
			
		||||
            new_link.get('responses'),
 | 
			
		||||
            new_link.get('usageLimit'),
 | 
			
		||||
            new_link.get('responseLimit'),
 | 
			
		||||
            new_link.get('path'),
 | 
			
		||||
            new_link.get('Survey_id')
 | 
			
		||||
        ))
 | 
			
		||||
 | 
			
		||||
        conn.commit()
 | 
			
		||||
        cursor.close()
 | 
			
		||||
        conn.close()
 | 
			
		||||
        return jsonify({"success": "Link created successfully", "data": new_link}), 201
 | 
			
		||||
    except Error as e:
 | 
			
		||||
        return jsonify({"error": f"Error creating link: {str(e)}"}), 500
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@app.route('/link/<int:id>', methods=['PUT'])
 | 
			
		||||
def update_link():
 | 
			
		||||
    try:
 | 
			
		||||
        update_link = request.json
 | 
			
		||||
        conn = get_db_connection()
 | 
			
		||||
        if isinstance(conn, tuple):
 | 
			
		||||
            return conn
 | 
			
		||||
        cursor = conn.cursor()
 | 
			
		||||
 | 
			
		||||
        cursor.execute('''
 | 
			
		||||
            UPDATE link SET 
 | 
			
		||||
                uses = %s, 
 | 
			
		||||
                responses = %s, 
 | 
			
		||||
                usageLimit = %s, 
 | 
			
		||||
                responseLimit = %s, 
 | 
			
		||||
                path = %s, 
 | 
			
		||||
                Survey_id = %s 
 | 
			
		||||
            WHERE id = %s
 | 
			
		||||
        ''', (
 | 
			
		||||
            update_link.get('uses'),
 | 
			
		||||
            update_link.get('responses'),
 | 
			
		||||
            update_link.get('usageLimit'),
 | 
			
		||||
            update_link.get('responseLimit'),
 | 
			
		||||
            update_link.get('path'),
 | 
			
		||||
            update_link.get('Survey_id'),
 | 
			
		||||
            id
 | 
			
		||||
        ))
 | 
			
		||||
 | 
			
		||||
        conn.commit()
 | 
			
		||||
        cursor.close()
 | 
			
		||||
        conn.close()
 | 
			
		||||
        if cursor.rowcount == 0:
 | 
			
		||||
            return jsonify({"error": f"Update error: link is not found"}), 404
 | 
			
		||||
        else:
 | 
			
		||||
            return jsonify({"success": f"Link from ID {id} updated successfully", "data": update_link}), 202
 | 
			
		||||
    except Error as e:
 | 
			
		||||
        return jsonify({"error": f"Error updating link: {str(e)}"}), 500
 | 
			
		||||
 | 
			
		||||
@app.route('/link/<int:id>', methods=['DELETE'])
 | 
			
		||||
def delete_link():
 | 
			
		||||
    try:
 | 
			
		||||
        conn = get_db_connection()
 | 
			
		||||
        if isinstance(conn, tuple):
 | 
			
		||||
            return conn
 | 
			
		||||
        cursor = conn.cursor()
 | 
			
		||||
        cursor.execute('DELETE FROM Link WHERE id = %s', [1])
 | 
			
		||||
        conn.commit()
 | 
			
		||||
        cursor.close()
 | 
			
		||||
        conn.close()
 | 
			
		||||
        if cursor.rowcount == 0:
 | 
			
		||||
            return jsonify({"error": f"Delete error: link is not found"}), 404
 | 
			
		||||
        else:
 | 
			
		||||
            return jsonify({"success": f"Link from ID {id} deleted successfully"}), 200
 | 
			
		||||
    except Error as e:
 | 
			
		||||
        return jsonify({"error": f"Error deleting link: {str(e)}"}), 500
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if name == 'main':
 | 
			
		||||
    app.run(debug=False)
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,93 @@
 | 
			
		||||
# Тестування працездатності системи
 | 
			
		||||
 | 
			
		||||
*В цьому розділі необхідно вказати засоби тестування, навести вихідні коди тестів та результати тестування.*
 | 
			
		||||
## Обробка запитів з методом GET
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
## Обробка запитів з методом POST
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
## Обробка запитів з методом PUT
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
## Обробка запитів з методом DELETE
 | 
			
		||||
 | 
			
		||||
<center style="
 | 
			
		||||
    border-radius:4px;
 | 
			
		||||
    border: 1px solid #cfd7e6;
 | 
			
		||||
    box-shadow: 0 1px 3px 0 rgba(89,105,129,.05), 0 1px 1px 0 rgba(0,0,0,.025);
 | 
			
		||||
    padding: 1em;
 | 
			
		||||
    margin-bottom: 15px;"
 | 
			
		||||
>
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
</center>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-23-41.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 21 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-23-46.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 36 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-23-49.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 28 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-23-52.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 34 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-23-55.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 31 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-23-57.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 30 KiB  | 
							
								
								
									
										
											BIN
										
									
								
								docs/test/img/photo_2024-06-06_18-24-01.jpg
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 35 KiB  | 
@ -20,6 +20,6 @@ git commit -m '[automated]: pushing regenerated documentation'
 | 
			
		||||
# git push -f git@github.com:boldak/<USERNAME>.github.io.git master
 | 
			
		||||
 | 
			
		||||
# if you are deploying to https://<USERNAME>.github.io/<REPO>
 | 
			
		||||
git push -f http://10.1.1.1:3000/hasslesstech/edu-dis-labs master:gh-pages
 | 
			
		||||
git push -f http://10.1.1.1:3000/EugenIO/edu-dis-labs master:gh-pages
 | 
			
		||||
 | 
			
		||||
cd -
 | 
			
		||||
 | 
			
		||||
@ -1,107 +1,2 @@
 | 
			
		||||
-- 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;
 | 
			
		||||
USE odb;
 | 
			
		||||
SELECT * FROM odb.link;
 | 
			
		||||