Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added new postgres7 schema, developed by Felipe Rodrigues da Silva <f…

…elipe@pontoexe.com>. Thanks Felipe!

I've personally not tested this yet so PostgrSQL user feedback is encouraged!
  • Loading branch information...
commit 7104dfc9efd47f0fc3c3e4975d27e6c1409ddbe8 1 parent b839163
authored
6  lib/db/README
@@ -7,3 +7,9 @@ the *creation* of the databases is very different.
7 7
 This directory (and the db directory in each module) 
8 8
 contains SQL code for creating Moodle databases on 
9 9
 each type of database.
  10
+
  11
+
  12
+mysql.sql - the main database Moodle is developed with
  13
+
  14
+postgres7.sql - the PostgreSQL schema is still alpha,
  15
+                your feedback is encouraged
134  lib/db/postgres7.sql
... ...
@@ -0,0 +1,134 @@
  1
+CREATE TABLE config ( 
  2
+   id SERIAL PRIMARY KEY,
  3
+	 name varchar(255) NOT NULL default '',
  4
+	 value varchar(255) NOT NULL default '',
  5
+	 CONSTRAINT config_name_uk UNIQUE (name)
  6
+);
  7
+
  8
+CREATE TABLE  course  (
  9
+   id  SERIAL PRIMARY KEY,
  10
+   category integer   NOT NULL default '0',
  11
+   password varchar(50) NOT NULL default '',
  12
+   fullname varchar(254) NOT NULL default '',
  13
+   shortname varchar(15) NOT NULL default '',
  14
+   summary text NOT NULL,
  15
+   format varchar(10) CHECK (format IN ('weeks','social','topics')) NOT NULL default 'weeks',
  16
+   newsitems integer   NOT NULL default '1',
  17
+   teacher varchar(100) NOT NULL default 'Teacher',
  18
+   teachers varchar(100) NOT NULL default 'Teachers',
  19
+   student varchar(100) NOT NULL default 'Student',
  20
+   students varchar(100) NOT NULL default 'Students',
  21
+   guest integer   NOT NULL default '0',
  22
+   startdate integer   NOT NULL default '0',
  23
+   numsections integer   NOT NULL default '1',
  24
+   marker integer   NOT NULL default '0',
  25
+   timecreated integer   NOT NULL default '0',
  26
+   timemodified integer   NOT NULL default '0'
  27
+);
  28
+
  29
+CREATE TABLE  course_categories  (
  30
+   id SERIAL PRIMARY KEY,
  31
+   name varchar(255) NOT NULL default ''
  32
+);
  33
+
  34
+CREATE TABLE  course_modules  (
  35
+   id SERIAL PRIMARY KEY,
  36
+   course integer   NOT NULL default '0',
  37
+   module integer   NOT NULL default '0',
  38
+   instance integer   NOT NULL default '0',
  39
+   section integer   NOT NULL default '0',
  40
+   added integer   NOT NULL default '0',
  41
+   deleted integer   NOT NULL default '0',
  42
+   score integer NOT NULL default '0'
  43
+);
  44
+
  45
+CREATE TABLE  course_sections  (
  46
+   id SERIAL PRIMARY KEY,
  47
+   course  integer   NOT NULL default '0',
  48
+   section  integer   NOT NULL default '0',
  49
+   summary  text NOT NULL,
  50
+   sequence  varchar(255) NOT NULL default ''
  51
+);
  52
+
  53
+CREATE TABLE  log  (
  54
+   id SERIAL PRIMARY KEY,
  55
+   time  integer   NOT NULL default '0',
  56
+   "user"  integer   NOT NULL default '0',
  57
+   ip  varchar(15) NOT NULL default '',
  58
+   course  integer   NOT NULL default '0',
  59
+   module  varchar(10) NOT NULL default '',
  60
+   action  varchar(15) NOT NULL default '',
  61
+   url  varchar(100) NOT NULL default '',
  62
+   info  varchar(255) NOT NULL default ''
  63
+);
  64
+
  65
+CREATE TABLE  log_display  (
  66
+   module  varchar(20) NOT NULL default '',
  67
+   action  varchar(20) NOT NULL default '',
  68
+   mtable  varchar(20) NOT NULL default '',
  69
+   field  varchar(40) NOT NULL default ''
  70
+);
  71
+
  72
+CREATE TABLE  modules  (
  73
+   id SERIAL PRIMARY KEY,
  74
+   name  varchar(20) NOT NULL default '',
  75
+   version  integer NOT NULL default '0',
  76
+   cron  integer   NOT NULL default '0',
  77
+   lastcron  integer   NOT NULL default '0',
  78
+   search  varchar(255) NOT NULL default ''
  79
+);
  80
+
  81
+CREATE TABLE  "user"  (
  82
+   id SERIAL PRIMARY KEY,
  83
+   confirmed  integer NOT NULL default '0',
  84
+   username  varchar(100) NOT NULL default '',
  85
+   password  varchar(32) NOT NULL default '',
  86
+   idnumber  varchar(12) default NULL,
  87
+   firstname  varchar(20) NOT NULL default '',
  88
+   lastname  varchar(20) NOT NULL default '',
  89
+   email  varchar(100) NOT NULL default '',
  90
+   icq  varchar(15) default NULL,
  91
+   phone1  varchar(20) default NULL,
  92
+   phone2  varchar(20) default NULL,
  93
+   institution  varchar(40) default NULL,
  94
+   department  varchar(30) default NULL,
  95
+   address  varchar(70) default NULL,
  96
+   city  varchar(20) default NULL,
  97
+   country  char(2) default NULL,
  98
+   timezone  float NOT NULL default '99',
  99
+   firstaccess  integer   NOT NULL default '0',
  100
+   lastaccess  integer   NOT NULL default '0',
  101
+   lastlogin  integer   NOT NULL default '0',
  102
+   currentlogin  integer   NOT NULL default '0',
  103
+   lastIP  varchar(15) default NULL,
  104
+   secret  varchar(15) default NULL,
  105
+   picture  integer default NULL,
  106
+   url  varchar(255) default NULL,
  107
+   description  text,
  108
+   mailformat  integer   NOT NULL default '1',
  109
+   maildisplay  integer   NOT NULL default '2',
  110
+   timemodified  integer   NOT NULL default '0',
  111
+	 CONSTRAINT user_username_uk UNIQUE (username)	 
  112
+);
  113
+
  114
+CREATE TABLE  user_admins  (
  115
+   id SERIAL PRIMARY KEY,
  116
+   "user"  integer   NOT NULL default '0'
  117
+);
  118
+
  119
+CREATE TABLE  user_students  (
  120
+   id SERIAL PRIMARY KEY,
  121
+   "user"  integer   NOT NULL default '0',
  122
+   course  integer   NOT NULL default '0',
  123
+   "start"  integer   NOT NULL default '0',
  124
+   "end"  integer   NOT NULL default '0',
  125
+   time  integer   NOT NULL default '0'
  126
+);
  127
+
  128
+CREATE TABLE  user_teachers  (
  129
+   id SERIAL PRIMARY KEY,
  130
+   "user" integer   NOT NULL default '0',
  131
+   course integer   NOT NULL default '0',
  132
+   authority integer NOT NULL default '3',
  133
+   role varchar(40) NOT NULL default ''
  134
+);

0 notes on commit 7104dfc

Please sign in to comment.
Something went wrong with that request. Please try again.