--
-- eFront v3.5.2 database creation file
--
--
-- Table 'bookmarks'
--
-- This table represents a bookmark. A bookmark is a link to a page that a student can save
-- Fields:
-- id (primary key): A numerical identifier
-- users_LOGIN: The user that this bookmark belongs to, matching the 'login' field at the 'users' table
-- users_USER_TYPE: The user this bookmark belongs to user type, matching the 'user_type' field at the 'users' table
-- name: The stored page title, for example 'Control Panel'
-- url: The url of the stored page, for example 'http://efront.example.com/student.php?ctg=control_panel'
CREATE TABLE bookmarks (
id int(11) NOT NULL auto_increment,
users_LOGIN varchar(255) NOT NULL,
users_USER_TYPE varchar(255) NOT NULL,
lessons_ID varchar(255),
name text,
url text,
PRIMARY KEY (id),
KEY users_LOGIN (users_LOGIN)
) DEFAULT CHARSET=utf8;
--
-- Table 'calendar'
--
-- This table represents a calendar event.
-- Fields:
-- id (primary key): A numerical identifier
-- lessons_ID: The id of the lesson that the event is for. The value matches the 'id' field in the 'lessons' table. If it's 0, it means that this event is not associated to any lesson
-- data: The event itself
-- timestamp: A 10-digit number representing the event's date and time
-- active: Whether this event should appear. Valid values are 0 (not active) and 1 (active)
-- users_LOGIN: The user that posted this event, matching the 'login' field at the 'users' table
CREATE TABLE calendar (
id int(11) NOT NULL auto_increment,
lessons_ID int(11) default '0',
data text,
timestamp varchar(10) NOT NULL,
active tinyint(1) NOT NULL default '1',
users_LOGIN varchar(255) NOT NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
--
-- Table 'chatmessages'
--
-- This table represent a message posted in the chat
-- Fields:
-- id (primary key): A numerical identifier
-- users_LOGIN: The user that posted this event, matching the 'login' field at the 'users' table
-- users_USER_TYPE: The user's that posted this event type, matching the 'user_type' field at the 'users' table
-- content: The message body
-- timestamp: A 10-digit number representing the time that message was posted
-- chatrooms_ID: The id of the chatroom that the message was posted in, matching the 'id' field of the 'chatrooms' table
CREATE TABLE chatmessages (
id int(11) NOT NULL auto_increment,
users_LOGIN varchar(255) NOT NULL,
users_USER_TYPE varchar(255) NOT NULL,
content text,
timestamp varchar(10) NOT NULL,
chatrooms_ID int(11) NOT NULL default '0',
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
--
-- Table 'chatrooms'
--
-- This table represent a chat room
-- Fields:
-- id (primary key): A numerical identifier
-- name: The name of the chat room
-- create_timestamp: A 10-digit number representing the time that room was created
-- users_LOGIN: The user that created this chat room
-- type: The chat room type, can be either 'private' or 'public'
-- active: Whether this room is active. Valid values are 0 (not active) and 1 (active)
-- lessons_ID: The id of the lesson that this room is associated to, corresponding to the 'id' field of the 'lessons' table. If it's null, then it not associated with any lesson
CREATE TABLE chatrooms (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
create_timestamp varchar(10) NOT NULL,
users_LOGIN varchar(255) NOT NULL,
type varchar(255) NOT NULL,
active tinyint(1) NOT NULL default '1',
lessons_ID int(11) default NULL,
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
--
-- Table 'comments'
--
-- This table represent a comment attached to a content unit
-- Fields:
-- id (primary key): A numerical identifier
-- data: The comment body
-- users_LOGIN: The user that created this chat room
-- content_ID: The id of the unit this comment was appended to, corresponding to the 'id' field of the 'content' table.
-- timestamp: A 10-digit number representing the time that the comment was posted
-- active: Whether this comment should appear.
CREATE TABLE comments (
id int(11) NOT NULL auto_increment,
data text NOT NULL,
users_LOGIN varchar(255) NOT NULL,
content_ID int(11) NOT NULL default '0',
timestamp varchar(10) NOT NULL,
active tinyint(1) NOT NULL default '0',
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
--
-- Table 'configuration'
--
-- This table holds the system's configuration options
-- Fields:
-- name (primary key): A word representing the option name
-- value: A string holding the option value
CREATE TABLE configuration (
name varchar(255) NOT NULL,
value text NOT NULL,
PRIMARY KEY (name)
) DEFAULT CHARSET=utf8;
--
-- Table 'content'
--
-- This table represent a content unit
-- Fields:
-- id (primary key): A numerical identifier
-- name: The unit name
-- data: The unit body
-- parent_content_ID: An id corresponding to a unit that is parent of this unit. If it's 0, then the unit has no parents (it is a 'root node')
-- lessons_ID: The id of the lesson that this unit is associated to, corresponding to the 'id' field of the 'lessons' table.
-- timestamp: A 10-digit number representing the time that the unit was created
-- ctg_type: The type of the unit. Can be one of: 'theory', 'examples', 'tests', 'scorm', 'scorm_test'
-- active: Whether this unit is active or not. Possible values are 0 (not active) and 1 (active)
-- previous_content_ID: An id corresponding to a unit that comes before this unit. If it's 0, then the unit is the first one
-- options: A string holding a serialized array with unit options
-- metadata: A string holding a serialized array with unit metadata
-- publish: Whether the unit created should be visible to students (ie 'published')
CREATE TABLE content (
id int(11) NOT NULL auto_increment,
name varchar(255) NOT NULL,
data longtext,
parent_content_ID int(11) default '0',
lessons_ID int(11) default '0',
timestamp varchar(10) NOT NULL,
ctg_type varchar(255) NOT NULL,
active tinyint(1) default '1',
previous_content_ID int(11) default '0',
options text default NULL,
metadata text default NULL,
publish tinyint(1) default '1',
PRIMARY KEY (id)
) DEFAULT CHARSET=utf8;
--
-- Table 'courses'
--
-- This table represent a course
-- Fields:
-- id (primary key): A numerical identifier
-- name: The course name
-- directions_ID: The id of the direction (category) that this course belongs to, corresponding to the 'id' field of the 'directions' table
-- info: A serialized array holding course information
-- price: The price of the course, or 0 if it's free
-- active: Whether this course is active or not. Possible values are 0 (not active) and 1 (active)
-- languages_NAME: The language that this course supports. It's value corresponds to the 'name' field of the 'languages' table
-- metadata: A string holding a serialized array with unit metadata
-- certficate:
-- auto_certificate: Whether a certificate should be issued automatically when a user auto completes a course. Possible values are 0 (no auto-complete) or 1 (auto-complete)
-- certificate_tpl:
-- auto_complete: Whether this course should be completed automatically when a user completed all its lessons. Possible values are 0 (no auto-complete) or 1 (auto-complete)
-- rules: A serialized array that corresponds to the succession rules applied among lessons in the course
-- from_timestamp: A timestamp that dictates when the course will become available
-- to_timestamp: A timestamp that dictates when the course will stop beeing available
-- shift: Sets whether shifting based on user registration time should be perform on the 'from_timestamp' and 'to_timestamp' field values
-- certificate_tpl_id
-- publish: Whether the course created should be visible to students (ie 'published')
-- options: A serialized array that holds the course options
CREATE TABLE courses (