From 48294bddbe527fe0cde92d6558e03de7a6d7a814 Mon Sep 17 00:00:00 2001
From: Ludwig Weihmann <ludwig.weihmann@uni-potsdam.de>
Date: Thu, 5 Jul 2018 09:59:29 +0200
Subject: [PATCH] feat: added sql script file for gamification

---
 .../src/scripts/dbschema/fltrail.sql          |  3 +-
 .../scripts/dbschema/setup_gamification.sql   | 58 +++++++++++++++++++
 2 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 gemeinsamforschen/src/scripts/dbschema/setup_gamification.sql

diff --git a/gemeinsamforschen/src/scripts/dbschema/fltrail.sql b/gemeinsamforschen/src/scripts/dbschema/fltrail.sql
index 717dbcde..2c363609 100644
--- a/gemeinsamforschen/src/scripts/dbschema/fltrail.sql
+++ b/gemeinsamforschen/src/scripts/dbschema/fltrail.sql
@@ -85,4 +85,5 @@ CREATE TABLE if not exists quiz
   correct tinyint(1) NOT NULL
 )
   ENGINE = InnoDB
-  DEFAULT CHARSET = utf8;
\ No newline at end of file
+  DEFAULT CHARSET = utf8;
+
diff --git a/gemeinsamforschen/src/scripts/dbschema/setup_gamification.sql b/gemeinsamforschen/src/scripts/dbschema/setup_gamification.sql
new file mode 100644
index 00000000..334349f1
--- /dev/null
+++ b/gemeinsamforschen/src/scripts/dbschema/setup_gamification.sql
@@ -0,0 +1,58 @@
+-- This script initializes tables to be used for gamification
+
+CREATE DATABASE IF NOT EXISTS `fltrail`
+  DEFAULT CHARACTER SET utf8
+  COLLATE utf8_general_ci;
+USE `fltrail`;
+
+---- events
+-- events can be
+--  * writing a comment
+--  * taking a quiz
+--  * creating a quiz
+--  * adding a part of the journal
+--  * completing the journal
+--  * doing peer assessment (actively and passively)
+CREATE TABLE if not exists events
+(
+  eventId     varchar(400) NOT NULL,
+  eventType   varchar(400) NOT NULL,
+  studentId   varchar(400) NOT NULL,
+  projectId   varchar(400) NOT NULL,
+  title       varchar(400) NOT NULL,
+  description varchar(400) NOT NULL
+)
+  ENGINE = InnoDB
+  DEFAULT CHARSET = utf8;
+
+---- tasks
+-- a task is something a student is obliged to do, such as
+--  * uploading parts of the journal
+--  * completing the journal
+--  * giving at least one feedback to another student
+--  * absolving peer assessment
+
+CREATE TABLE if not exists tasks
+(
+  taskId     varchar(400) NOT NULL,
+  taskType   varchar(400) NOT NULL,
+  projectId   varchar(400) NOT NULL,
+  title       varchar(400) NOT NULL,
+  description varchar(400) NOT NULL,
+  state       varchar(400) NOT NULL -- should be "open" or "closed"
+)
+  ENGINE = InnoDB
+  DEFAULT CHARSET = utf8;
+
+--- achievements
+CREATE TABLE if not exists achievements
+(
+  author varchar(400) NOT NULL,
+  projectId varchar(400) NOT NULL,
+  question varchar(400) NOT NULL,
+  mcType varchar(400) NOT NULL,
+  answer varchar(400) NOT NULL,
+  correct tinyint(1) NOT NULL
+)
+  ENGINE = InnoDB
+  DEFAULT CHARSET = utf8;
-- 
GitLab