From: martin Date: Fri, 31 May 2002 09:18:12 +0000 (+0000) Subject: Removed "logs" and added new log format: "log" and "log_display" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=93777df60d09cfc3522719efb739750e55f88dc7;p=moodle.git Removed "logs" and added new log format: "log" and "log_display" --- diff --git a/lib/db/mysql.sql b/lib/db/mysql.sql index 1b7b79f48b..d1fa14ac96 100644 --- a/lib/db/mysql.sql +++ b/lib/db/mysql.sql @@ -1,180 +1,206 @@ -# Database : `moodle` -# -------------------------------------------------------- - -# -# Table structure for table `course` -# - -CREATE TABLE course ( - id int(10) unsigned NOT NULL auto_increment, - category int(10) unsigned NOT NULL default '0', - password varchar(50) NOT NULL default '', - fullname varchar(254) NOT NULL default '', - shortname varchar(15) NOT NULL default '', - summary text NOT NULL, - format tinyint(4) NOT NULL default '1', - teacher varchar(100) NOT NULL default 'Teacher', - startdate int(10) unsigned NOT NULL default '0', - enddate int(10) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id) -); -# -------------------------------------------------------- - -# -# Table structure for table `course_categories` -# - -CREATE TABLE course_categories ( - id int(10) unsigned NOT NULL auto_increment, - name varchar(255) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY id (id) -); -# -------------------------------------------------------- - -# -# Table structure for table `course_modules` -# - -CREATE TABLE course_modules ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - module int(10) unsigned NOT NULL default '0', - instance int(10) unsigned NOT NULL default '0', - week int(10) unsigned NOT NULL default '0', - added int(10) unsigned NOT NULL default '0', - deleted tinyint(1) unsigned NOT NULL default '0', - score tinyint(4) NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `course_weeks` -# - -CREATE TABLE course_weeks ( - id int(10) unsigned NOT NULL auto_increment, - course int(10) unsigned NOT NULL default '0', - week int(10) unsigned NOT NULL default '0', - summary varchar(255) NOT NULL default '', - sequence varchar(255) NOT NULL default '', - PRIMARY KEY (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `logs` -# - -CREATE TABLE logs ( - id int(10) unsigned NOT NULL auto_increment, - time int(10) unsigned NOT NULL default '0', - user int(10) unsigned NOT NULL default '0', - course int(10) unsigned NOT NULL default '0', - ip varchar(15) NOT NULL default '', - url varchar(200) NOT NULL default '', - message varchar(255) NOT NULL default '', - PRIMARY KEY (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `modules` -# - -CREATE TABLE modules ( - id int(10) unsigned NOT NULL auto_increment, - name varchar(20) NOT NULL default '', - fullname varchar(255) NOT NULL default '', - version int(10) NOT NULL default '0', - cron int(10) unsigned NOT NULL default '0', - lastcron int(10) unsigned NOT NULL default '0', - search varchar(255) NOT NULL default '', - PRIMARY KEY (id), - UNIQUE KEY id (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `user` -# - -CREATE TABLE user ( - id int(10) unsigned NOT NULL auto_increment, - confirmed tinyint(1) NOT NULL default '0', - username varchar(100) NOT NULL default '', - password varchar(32) NOT NULL default '', - idnumber varchar(12) default NULL, - firstname varchar(20) NOT NULL default '', - lastname varchar(20) NOT NULL default '', - email varchar(100) NOT NULL default '', - icq varchar(15) default NULL, - phone1 varchar(20) default NULL, - phone2 varchar(20) default NULL, - institution varchar(40) default NULL, - department varchar(30) default NULL, - address varchar(70) default NULL, - city varchar(20) default NULL, - country char(2) default NULL, - firstaccess int(10) unsigned NOT NULL default '0', - lastaccess int(10) unsigned NOT NULL default '0', - lastlogin int(10) unsigned NOT NULL default '0', - currentlogin int(10) unsigned NOT NULL default '0', - lastIP varchar(15) default NULL, - personality varchar(5) default NULL, - picture tinyint(1) default NULL, - url varchar(255) default NULL, - description text, - research tinyint(1) unsigned NOT NULL default '0', - forwardmail tinyint(1) unsigned NOT NULL default '0', - timemodified int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY username (username), - UNIQUE KEY id (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `user_admins` -# - -CREATE TABLE user_admins ( - id int(10) unsigned NOT NULL auto_increment, - user int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `user_students` -# - -CREATE TABLE user_students ( - id int(10) unsigned NOT NULL auto_increment, - user int(10) unsigned NOT NULL default '0', - course int(10) unsigned NOT NULL default '0', - start int(10) unsigned NOT NULL default '0', - end int(10) unsigned NOT NULL default '0', - time int(10) unsigned NOT NULL default '0', - PRIMARY KEY (id), - UNIQUE KEY id (id) -) ; -# -------------------------------------------------------- - -# -# Table structure for table `user_teachers` -# - -CREATE TABLE user_teachers ( - id int(10) unsigned NOT NULL auto_increment, - user int(10) unsigned NOT NULL default '0', - course int(10) unsigned NOT NULL default '0', - authority varchar(10) default NULL, - PRIMARY KEY (id), - UNIQUE KEY id (id) -) ; - +# phpMyAdmin MySQL-Dump +# version 2.3.0-dev +# http://phpwizard.net/phpMyAdmin/ +# http://www.phpmyadmin.net/ (download page) +# +# Host: localhost +# Generation Time: May 29, 2002 at 05:19 PM +# Server version: 3.23.49 +# PHP Version: 4.1.2 +# Database : `moodle` +# -------------------------------------------------------- + +# +# Table structure for table `course` +# + +CREATE TABLE course ( + id int(10) unsigned NOT NULL auto_increment, + category int(10) unsigned NOT NULL default '0', + password varchar(50) NOT NULL default '', + fullname varchar(254) NOT NULL default '', + shortname varchar(15) NOT NULL default '', + summary text NOT NULL, + format tinyint(4) NOT NULL default '1', + teacher varchar(100) NOT NULL default 'Teacher', + startdate int(10) unsigned NOT NULL default '0', + enddate int(10) unsigned NOT NULL default '0', + timemodified int(10) unsigned NOT NULL default '0', + PRIMARY KEY (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `course_categories` +# + +CREATE TABLE course_categories ( + id int(10) unsigned NOT NULL auto_increment, + name varchar(255) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE KEY id (id) +) TYPE=MyISAM COMMENT='Course categories'; +# -------------------------------------------------------- + +# +# Table structure for table `course_modules` +# + +CREATE TABLE course_modules ( + id int(10) unsigned NOT NULL auto_increment, + course int(10) unsigned NOT NULL default '0', + module int(10) unsigned NOT NULL default '0', + instance int(10) unsigned NOT NULL default '0', + week int(10) unsigned NOT NULL default '0', + added int(10) unsigned NOT NULL default '0', + deleted tinyint(1) unsigned NOT NULL default '0', + score tinyint(4) NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `course_weeks` +# + +CREATE TABLE course_weeks ( + id int(10) unsigned NOT NULL auto_increment, + course int(10) unsigned NOT NULL default '0', + week int(10) unsigned NOT NULL default '0', + summary varchar(255) NOT NULL default '', + sequence varchar(255) NOT NULL default '', + PRIMARY KEY (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `log` +# + +CREATE TABLE log ( + id int(10) unsigned NOT NULL auto_increment, + time int(10) unsigned NOT NULL default '0', + user int(10) unsigned NOT NULL default '0', + ip varchar(15) NOT NULL default '', + course int(10) unsigned NOT NULL default '0', + module varchar(10) NOT NULL default '', + action varchar(15) NOT NULL default '', + url varchar(100) NOT NULL default '', + info varchar(255) NOT NULL default '', + PRIMARY KEY (id) +) TYPE=MyISAM COMMENT='Every action is logged as far as possible.'; +# -------------------------------------------------------- + +# +# Table structure for table `log_display` +# + +CREATE TABLE log_display ( + module varchar(20) NOT NULL default '', + action varchar(20) NOT NULL default '', + table varchar(20) NOT NULL default '', + field varchar(40) NOT NULL default '' +) TYPE=MyISAM COMMENT='For a particular module/action, specifies a table field.'; +# -------------------------------------------------------- + +# +# Table structure for table `modules` +# + +CREATE TABLE modules ( + id int(10) unsigned NOT NULL auto_increment, + name varchar(20) NOT NULL default '', + fullname varchar(255) NOT NULL default '', + version int(10) NOT NULL default '0', + cron int(10) unsigned NOT NULL default '0', + lastcron int(10) unsigned NOT NULL default '0', + search varchar(255) NOT NULL default '', + PRIMARY KEY (id), + UNIQUE KEY id (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `user` +# + +CREATE TABLE user ( + id int(10) unsigned NOT NULL auto_increment, + confirmed tinyint(1) NOT NULL default '0', + username varchar(100) NOT NULL default '', + password varchar(32) NOT NULL default '', + idnumber varchar(12) default NULL, + firstname varchar(20) NOT NULL default '', + lastname varchar(20) NOT NULL default '', + email varchar(100) NOT NULL default '', + icq varchar(15) default NULL, + phone1 varchar(20) default NULL, + phone2 varchar(20) default NULL, + institution varchar(40) default NULL, + department varchar(30) default NULL, + address varchar(70) default NULL, + city varchar(20) default NULL, + country char(2) default NULL, + firstaccess int(10) unsigned NOT NULL default '0', + lastaccess int(10) unsigned NOT NULL default '0', + lastlogin int(10) unsigned NOT NULL default '0', + currentlogin int(10) unsigned NOT NULL default '0', + lastIP varchar(15) default NULL, + personality varchar(5) default NULL, + picture tinyint(1) default NULL, + url varchar(255) default NULL, + description text, + research tinyint(1) unsigned NOT NULL default '0', + forwardmail tinyint(1) unsigned NOT NULL default '0', + timemodified int(10) unsigned NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id), + UNIQUE KEY username (username) +) TYPE=MyISAM COMMENT='One record for each person'; +# -------------------------------------------------------- + +# +# Table structure for table `user_admins` +# + +CREATE TABLE user_admins ( + id int(10) unsigned NOT NULL auto_increment, + user int(10) unsigned NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id) +) TYPE=MyISAM COMMENT='One record per administrator user'; +# -------------------------------------------------------- + +# +# Table structure for table `user_students` +# + +CREATE TABLE user_students ( + id int(10) unsigned NOT NULL auto_increment, + user int(10) unsigned NOT NULL default '0', + course int(10) unsigned NOT NULL default '0', + start int(10) unsigned NOT NULL default '0', + end int(10) unsigned NOT NULL default '0', + time int(10) unsigned NOT NULL default '0', + PRIMARY KEY (id), + UNIQUE KEY id (id) +) TYPE=MyISAM; +# -------------------------------------------------------- + +# +# Table structure for table `user_teachers` +# + +CREATE TABLE user_teachers ( + id int(10) unsigned NOT NULL auto_increment, + user int(10) unsigned NOT NULL default '0', + course int(10) unsigned NOT NULL default '0', + authority varchar(10) default NULL, + PRIMARY KEY (id), + UNIQUE KEY id (id) +) TYPE=MyISAM COMMENT='One record per teacher per course'; + + + + diff --git a/lib/db/postgres7.sql b/lib/db/postgres7.sql index d1e865ebb1..bacf7c58ec 100644 --- a/lib/db/postgres7.sql +++ b/lib/db/postgres7.sql @@ -14,33 +14,42 @@ BEGIN; CREATE SEQUENCE course_id_seq; --- Database : `moodle` --- -------------------------------------------------------- - --- --- Table structure for table `course` --- - -CREATE TABLE "course" ( - "id" INT4 DEFAULT nextval('course_id_seq'), - "category" INT4 NOT NULL DEFAULT '0', - "password" varchar(50) NOT NULL DEFAULT '', - "fullname" varchar(254) NOT NULL DEFAULT '', - "shortname" varchar(15) NOT NULL DEFAULT '', - "summary" TEXT DEFAULT '' NOT NULL, - "format" INT2 NOT NULL DEFAULT '1', - "teacher" varchar(100) NOT NULL DEFAULT 'Teacher', - "startdate" INT4 NOT NULL DEFAULT '0', - "enddate" INT4 NOT NULL DEFAULT '0', - "timemodified" INT4 NOT NULL DEFAULT '0', - PRIMARY KEY (id) +-- phpMyAdmin MySQL-Dump +-- version 2.3.0-dev +-- http://phpwizard.net/phpMyAdmin/ +-- http://www.phpmyadmin.net/ (download page) +-- +-- Host: localhost +-- Generation Time: May 29, 2002 at 05:19 PM +-- Server version: 3.23.49 +-- PHP Version: 4.1.2 +-- Database : `moodle` +-- -------------------------------------------------------- + +-- +-- Table structure for table `course` +-- + +CREATE TABLE course ( + id INT4 DEFAULT nextval('course_id_seq'), + category INT4 NOT NULL DEFAULT '0', + password varchar(50) NOT NULL DEFAULT '', + fullname varchar(254) NOT NULL DEFAULT '', + shortname varchar(15) NOT NULL DEFAULT '', + summary TEXT DEFAULT '' NOT NULL, + format INT2 NOT NULL DEFAULT '1', + teacher varchar(100) NOT NULL DEFAULT 'Teacher', + startdate INT4 NOT NULL DEFAULT '0', + enddate INT4 NOT NULL DEFAULT '0', + timemodified INT4 NOT NULL DEFAULT '0', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- Table structure for table `course_categories` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `course_categories` +-- + -- @@ -49,17 +58,17 @@ CREATE TABLE "course" ( CREATE SEQUENCE course_categories_id_seq; -CREATE TABLE "course_categories" ( - "id" INT4 DEFAULT nextval('course_categories_id_seq'), - "name" varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id), +CREATE TABLE course_categories ( + id INT4 DEFAULT nextval('course_categories_id_seq'), + name varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- Table structure for table `course_modules` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `course_modules` +-- + -- @@ -68,23 +77,23 @@ CREATE TABLE "course_categories" ( CREATE SEQUENCE course_modules_id_seq; -CREATE TABLE "course_modules" ( - "id" INT4 DEFAULT nextval('course_modules_id_seq'), - "course" INT4 NOT NULL DEFAULT '0', - "module" INT4 NOT NULL DEFAULT '0', - "instance" INT4 NOT NULL DEFAULT '0', - "week" INT4 NOT NULL DEFAULT '0', - "added" INT4 NOT NULL DEFAULT '0', - "deleted" INT2 NOT NULL DEFAULT '0', - "score" INT2 NOT NULL DEFAULT '0', - PRIMARY KEY (id), +CREATE TABLE course_modules ( + id INT4 DEFAULT nextval('course_modules_id_seq'), + course INT4 NOT NULL DEFAULT '0', + module INT4 NOT NULL DEFAULT '0', + instance INT4 NOT NULL DEFAULT '0', + week INT4 NOT NULL DEFAULT '0', + added INT4 NOT NULL DEFAULT '0', + deleted INT2 NOT NULL DEFAULT '0', + score INT2 NOT NULL DEFAULT '0', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `course_weeks` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `course_weeks` +-- + -- @@ -93,44 +102,58 @@ CREATE TABLE "course_modules" ( CREATE SEQUENCE course_weeks_id_seq; -CREATE TABLE "course_weeks" ( - "id" INT4 DEFAULT nextval('course_weeks_id_seq'), - "course" INT4 NOT NULL DEFAULT '0', - "week" INT4 NOT NULL DEFAULT '0', - "summary" varchar(255) NOT NULL DEFAULT '', - "sequence" varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id) +CREATE TABLE course_weeks ( + id INT4 DEFAULT nextval('course_weeks_id_seq'), + course INT4 NOT NULL DEFAULT '0', + week INT4 NOT NULL DEFAULT '0', + summary varchar(255) NOT NULL DEFAULT '', + sequence varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `logs` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `log` +-- + -- --- Sequences for table LOGS +-- Sequences for table LOG -- -CREATE SEQUENCE logs_id_seq; +CREATE SEQUENCE log_id_seq; -CREATE TABLE "logs" ( - "id" INT4 DEFAULT nextval('logs_id_seq'), - "time" INT4 NOT NULL DEFAULT '0', - "user" INT4 NOT NULL DEFAULT '0', - "course" INT4 NOT NULL DEFAULT '0', - "ip" varchar(15) NOT NULL DEFAULT '', - "url" varchar(200) NOT NULL DEFAULT '', - "message" varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id) +CREATE TABLE log ( + id INT4 DEFAULT nextval('log_id_seq'), + time INT4 NOT NULL DEFAULT '0', + user INT4 NOT NULL DEFAULT '0', + ip varchar(15) NOT NULL DEFAULT '', + course INT4 NOT NULL DEFAULT '0', + module varchar(10) NOT NULL DEFAULT '', + action varchar(15) NOT NULL DEFAULT '', + url varchar(100) NOT NULL DEFAULT '', + info varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `modules` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `log_display` +-- + +CREATE TABLE log_display ( + module varchar(20) NOT NULL DEFAULT '', + action varchar(20) NOT NULL DEFAULT '', + table varchar(20) NOT NULL DEFAULT '', + field varchar(40) NOT NULL DEFAULT '' +); +-- -------------------------------------------------------- + +-- +-- Table structure for table `modules` +-- + -- @@ -139,22 +162,22 @@ CREATE TABLE "logs" ( CREATE SEQUENCE modules_id_seq; -CREATE TABLE "modules" ( - "id" INT4 DEFAULT nextval('modules_id_seq'), - "name" varchar(20) NOT NULL DEFAULT '', - "fullname" varchar(255) NOT NULL DEFAULT '', - "version" INT4 NOT NULL DEFAULT '0', - "cron" INT4 NOT NULL DEFAULT '0', - "lastcron" INT4 NOT NULL DEFAULT '0', - "search" varchar(255) NOT NULL DEFAULT '', - PRIMARY KEY (id), +CREATE TABLE modules ( + id INT4 DEFAULT nextval('modules_id_seq'), + name varchar(20) NOT NULL DEFAULT '', + fullname varchar(255) NOT NULL DEFAULT '', + version INT4 NOT NULL DEFAULT '0', + cron INT4 NOT NULL DEFAULT '0', + lastcron INT4 NOT NULL DEFAULT '0', + search varchar(255) NOT NULL DEFAULT '', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `user` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + -- @@ -163,43 +186,43 @@ CREATE TABLE "modules" ( CREATE SEQUENCE user_id_seq; -CREATE TABLE "user" ( - "id" INT4 DEFAULT nextval('user_id_seq'), - "confirmed" INT2 NOT NULL DEFAULT '0', - "username" varchar(100) NOT NULL DEFAULT '', - "password" varchar(32) NOT NULL DEFAULT '', - "idnumber" varchar(12) DEFAULT NULL, - "firstname" varchar(20) NOT NULL DEFAULT '', - "lastname" varchar(20) NOT NULL DEFAULT '', - "email" varchar(100) NOT NULL DEFAULT '', - "icq" varchar(15) DEFAULT NULL, - "phone1" varchar(20) DEFAULT NULL, - "phone2" varchar(20) DEFAULT NULL, - "institution" varchar(40) DEFAULT NULL, - "department" varchar(30) DEFAULT NULL, - "address" varchar(70) DEFAULT NULL, - "city" varchar(20) DEFAULT NULL, - "country" char(2) DEFAULT NULL, - "firstaccess" INT4 NOT NULL DEFAULT '0', - "lastaccess" INT4 NOT NULL DEFAULT '0', - "lastlogin" INT4 NOT NULL DEFAULT '0', - "currentlogin" INT4 NOT NULL DEFAULT '0', - "lastIP" varchar(15) DEFAULT NULL, - "personality" varchar(5) DEFAULT NULL, - "picture" INT2 DEFAULT NULL, - "url" varchar(255) DEFAULT NULL, - "description" text, - "research" INT2 NOT NULL DEFAULT '0', - "forwardmail" INT2 NOT NULL DEFAULT '0', - "timemodified" INT4 NOT NULL DEFAULT '0', - PRIMARY KEY (id), +CREATE TABLE user ( + id INT4 DEFAULT nextval('user_id_seq'), + confirmed INT2 NOT NULL DEFAULT '0', + username varchar(100) NOT NULL DEFAULT '', + password varchar(32) NOT NULL DEFAULT '', + idnumber varchar(12) DEFAULT NULL, + firstname varchar(20) NOT NULL DEFAULT '', + lastname varchar(20) NOT NULL DEFAULT '', + email varchar(100) NOT NULL DEFAULT '', + icq varchar(15) DEFAULT NULL, + phone1 varchar(20) DEFAULT NULL, + phone2 varchar(20) DEFAULT NULL, + institution varchar(40) DEFAULT NULL, + department varchar(30) DEFAULT NULL, + address varchar(70) DEFAULT NULL, + city varchar(20) DEFAULT NULL, + country char(2) DEFAULT NULL, + firstaccess INT4 NOT NULL DEFAULT '0', + lastaccess INT4 NOT NULL DEFAULT '0', + lastlogin INT4 NOT NULL DEFAULT '0', + currentlogin INT4 NOT NULL DEFAULT '0', + lastIP varchar(15) DEFAULT NULL, + personality varchar(5) DEFAULT NULL, + picture INT2 DEFAULT NULL, + url varchar(255) DEFAULT NULL, + description text, + research INT2 NOT NULL DEFAULT '0', + forwardmail INT2 NOT NULL DEFAULT '0', + timemodified INT4 NOT NULL DEFAULT '0', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `user_admins` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_admins` +-- + -- @@ -208,17 +231,17 @@ CREATE TABLE "user" ( CREATE SEQUENCE user_admins_id_seq; -CREATE TABLE "user_admins" ( - "id" INT4 DEFAULT nextval('user_admins_id_seq'), - "user" INT4 NOT NULL DEFAULT '0', - PRIMARY KEY (id), +CREATE TABLE user_admins ( + id INT4 DEFAULT nextval('user_admins_id_seq'), + user INT4 NOT NULL DEFAULT '0', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `user_students` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_students` +-- + -- @@ -227,21 +250,21 @@ CREATE TABLE "user_admins" ( CREATE SEQUENCE user_students_id_seq; -CREATE TABLE "user_students" ( - "id" INT4 DEFAULT nextval('user_students_id_seq'), - "user" INT4 NOT NULL DEFAULT '0', - "course" INT4 NOT NULL DEFAULT '0', - "start" INT4 NOT NULL DEFAULT '0', - "end" INT4 NOT NULL DEFAULT '0', - "time" INT4 NOT NULL DEFAULT '0', - PRIMARY KEY (id), +CREATE TABLE user_students ( + id INT4 DEFAULT nextval('user_students_id_seq'), + user INT4 NOT NULL DEFAULT '0', + course INT4 NOT NULL DEFAULT '0', + start INT4 NOT NULL DEFAULT '0', + end INT4 NOT NULL DEFAULT '0', + time INT4 NOT NULL DEFAULT '0', + PRIMARY KEY (id) ); --- -------------------------------------------------------- - --- --- "Table" structure for table `user_teachers` --- - +-- -------------------------------------------------------- + +-- +-- Table structure for table `user_teachers` +-- + -- @@ -250,117 +273,120 @@ CREATE TABLE "user_students" ( CREATE SEQUENCE user_teachers_id_seq; -CREATE TABLE "user_teachers" ( - "id" INT4 DEFAULT nextval('user_teachers_id_seq'), - "user" INT4 NOT NULL DEFAULT '0', - "course" INT4 NOT NULL DEFAULT '0', - "authority" varchar(10) DEFAULT NULL, - PRIMARY KEY (id), +CREATE TABLE user_teachers ( + id INT4 DEFAULT nextval('user_teachers_id_seq'), + user INT4 NOT NULL DEFAULT '0', + course INT4 NOT NULL DEFAULT '0', + authority varchar(10) DEFAULT NULL, + PRIMARY KEY (id) ); - + + + + -- -- Indexes for table USER_TEACHERS -- -CREATE UNIQUE INDEX id_user_teachers_index ON "user_teachers" ("id"); +CREATE UNIQUE INDEX id_user_teachers_index ON user_teachers (id); -- -- Indexes for table COURSE_CATEGORIES -- -CREATE UNIQUE INDEX id_course_categories_index ON "course_categories" ("id"); +CREATE UNIQUE INDEX id_course_categories_index ON course_categories (id); -- -- Indexes for table USER_STUDENTS -- -CREATE UNIQUE INDEX id_user_students_index ON "user_students" ("id"); +CREATE UNIQUE INDEX id_user_students_index ON user_students (id); -- -- Indexes for table MODULES -- -CREATE UNIQUE INDEX id_modules_index ON "modules" ("id"); +CREATE UNIQUE INDEX id_modules_index ON modules (id); -- -- Indexes for table USER -- -CREATE UNIQUE INDEX username_user_index ON "user" ("username"); -CREATE UNIQUE INDEX id_user_index ON "user" ("id"); +CREATE UNIQUE INDEX id_user_index ON user (id); +CREATE UNIQUE INDEX username_user_index ON user (username); -- -- Indexes for table USER_ADMINS -- -CREATE UNIQUE INDEX id_user_admins_index ON "user_admins" ("id"); +CREATE UNIQUE INDEX id_user_admins_index ON user_admins (id); -- -- Indexes for table COURSE_MODULES -- -CREATE UNIQUE INDEX id_course_modules_index ON "course_modules" ("id"); +CREATE UNIQUE INDEX id_course_modules_index ON course_modules (id); -- -- Sequences for table USER_TEACHERS -- -SELECT SETVAL('user_teachers_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "user_teachers")); +SELECT SETVAL('user_teachers_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from user_teachers)); -- -- Sequences for table USER_STUDENTS -- -SELECT SETVAL('user_students_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "user_students")); +SELECT SETVAL('user_students_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from user_students)); + +-- +-- Sequences for table LOG +-- + +SELECT SETVAL('log_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from log)); -- -- Sequences for table MODULES -- -SELECT SETVAL('modules_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "modules")); +SELECT SETVAL('modules_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from modules)); -- -- Sequences for table USER -- -SELECT SETVAL('user_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "user")); +SELECT SETVAL('user_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from user)); -- -- Sequences for table COURSE -- -SELECT SETVAL('course_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "course")); +SELECT SETVAL('course_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from course)); -- -- Sequences for table USER_ADMINS -- -SELECT SETVAL('user_admins_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "user_admins")); +SELECT SETVAL('user_admins_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from user_admins)); -- -- Sequences for table COURSE_CATEGORIES -- -SELECT SETVAL('course_categories_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "course_categories")); +SELECT SETVAL('course_categories_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from course_categories)); -- -- Sequences for table COURSE_WEEKS -- -SELECT SETVAL('course_weeks_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "course_weeks")); - --- --- Sequences for table LOGS --- - -SELECT SETVAL('logs_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "logs")); +SELECT SETVAL('course_weeks_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from course_weeks)); -- -- Sequences for table COURSE_MODULES -- -SELECT SETVAL('course_modules_id_seq',(select case when max("id")>0 then max("id")+1 else 1 end from "course_modules")); +SELECT SETVAL('course_modules_id_seq',(select case when max(id)>0 then max(id)+1 else 1 end from course_modules)); COMMIT;