home *** CD-ROM | disk | FTP | other *** search
/ MetaWorlds Beta 17 / MSQMW17.ZIP / DATA.Z / MSGBASE.SQL < prev    next >
Encoding:
Text File  |  1997-02-05  |  4.6 KB  |  116 lines

  1. -- This file contains the database table creation and insertion code for
  2. -- the message bases and the email server.
  3.  
  4. --/////////////////////////////////////////////////////////////////////
  5. --//  General Message Stuff
  6. --/////////////////////////////////////////////////////////////////////
  7.  
  8.  
  9. CREATE TABLE Messages(
  10.   MsgID                   integer NOT NULL PRIMARY KEY DEFAULT AUTOINCREMENT,
  11.   MsgSubject              long varchar NOT NULL DEFAULT '',
  12.   MsgFrom                 long varchar NOT NULL DEFAULT '',
  13.   MsgTo                   long varchar NOT NULL DEFAULT '',
  14.   MsgBody                 long binary NOT NULL DEFAULT '',
  15.   MsgPrivate              integer NOT NULL DEFAULT 0,
  16.   PostDate                date,
  17.   PostTime                long varchar,
  18.   ReadDate                date,
  19.   ReadTime                long varchar,
  20.   ContentType             long varchar NOT NULL DEFAULT '',
  21.   ContentTransferEncoding long varchar NOT NULL DEFAULT '',
  22.   ReceiveDate                    long varchar,
  23.   ReceiveTime                    long varchar,
  24.   LastDeliveryDateTime        datetime,
  25.   LastWarning                    datetime,
  26.   MsgRaw                   long binary NOT NULL DEFAULT '',
  27. );
  28.  
  29. CREATE TABLE Msg_User(
  30.   MsgID                   integer NOT NULL DEFAULT 0,
  31.   UsrID                   integer NOT NULL DEFAULT 0
  32. );
  33.  
  34. CREATE TABLE MsgB_Msg(
  35.   MbID                    integer NOT NULL DEFAULT 0,
  36.   MID                     integer NOT NULL DEFAULT 0
  37. );
  38.  
  39. CREATE TABLE LMRS(
  40.   UsrID                   integer NOT NULL DEFAULT 0,
  41.   MbID                    integer NOT NULL DEFAULT 0,
  42.   LMR                     integer NOT NULL DEFAULT 0
  43. );
  44.  
  45. CREATE INDEX MSG_MessageID on "DBA".Messages (MsgID);
  46. CREATE INDEX MSG_MsgB_MsgBID on "DBA".MsgB_Msg (MbID);
  47. CREATE INDEX MSG_MsgB_MsgID on "DBA".MsgB_Msg (MID);
  48. CREATE INDEX MSG_MessageTO on "DBA".Msg_User (UsrId);
  49.  
  50. --/////////////////////////////////////////////////////////////////////
  51. --//  MetaWorlds type messagebase stuff
  52. --/////////////////////////////////////////////////////////////////////
  53.  
  54. Insert Into SubSysTP (Id, Descript, QueryScript, TypeParam, Button) VALUES (1, 'Message Base','msgbase','msgbase?DOCUMENT=msglstpr.sht&id=','msgbs5.gif');
  55.  
  56. Insert Into SubSysIn (id,typeid,instparam,descript) VALUES (3, 1, '3', 'Main Board: Messages');
  57. Insert Into sub_prof (InstanceID, ProfileId) VALUES (3, 0); // new user
  58. Insert Into sub_prof (InstanceID, ProfileId) VALUES (3, 1); // sysop
  59. Insert Into sub_prof (InstanceID, ProfileId) VALUES (3, 2); // guest
  60. Insert Into Area_Sub (AreaId, InstanceId) VALUES (0, 3);
  61.  
  62. Insert Into SubSysIn (id,typeid,instparam,descript) VALUES (5, 1, '5', 'New User: Messages');
  63. Insert Into sub_prof (InstanceID, ProfileId) VALUES (5, 0); // new user
  64. Insert Into sub_prof (InstanceID, ProfileId) VALUES (5, 1); // sysop
  65. Insert Into Area_Sub (AreaId, InstanceId) VALUES (1, 5);
  66.  
  67.  
  68. --/////////////////////////////////////////////////////////////////////
  69. --//  PCBoard type messagebase stuff
  70. --/////////////////////////////////////////////////////////////////////
  71.  
  72. Insert Into SubSysTP (Id, Descript, QueryScript, TypeParam, Button) VALUES (5, 'PCBoard Message Base','','msgbase?DOCUMENT=msglstpr.sht&id=','msgbs5.gif');
  73.  
  74. Insert Into SubSysIn (id,typeid,instparam,descript) VALUES (101, 5, '101&conf=0', 'PC Board Messages');
  75. Insert Into sub_prof (InstanceID, ProfileId) VALUES (101, 1); -- sysop
  76. Insert Into Area_Sub (AreaId, InstanceId) VALUES (0, 101);
  77.  
  78.  
  79. --/////////////////////////////////////////////////////////////////////
  80. --//  Email Server stuff
  81. --/////////////////////////////////////////////////////////////////////
  82.  
  83.  
  84. create table mail_prot
  85. (
  86.   id    integer NOT NULL DEFAULT 0,
  87.   name  long varchar NOT NULL DEFAULT 'Undefined'
  88. );
  89.  
  90. CREATE TABLE mail_prot_instance
  91. (
  92.   id            integer NOT NULL DEFAULT AUTOINCREMENT,
  93.   prot_id       integer NOT NULL DEFAULT 0,
  94.   address       long varchar NOT NULL DEFAULT '',
  95.   msgb_id       integer NOT NULL DEFAULT 0
  96. );
  97.  
  98. create table mpi_msg
  99. (
  100.   pi_id   integer NOT NULL DEFAULT 0,
  101.   msg_id  integer NOT NULL DEFAULT 0,
  102. );
  103.  
  104. insert into mail_prot(id, name) values (0, 'SMTP');
  105.  
  106. Insert into mail_prot_instance(id, prot_id, address, msgb_id) values(0, 0, '<default>', -5);
  107.  
  108. -- this is the personal mail message base
  109. Insert Into SubSysIn (id,typeid,instparam,descript) VALUES (-5, 1, '-5', 'Email');
  110. Insert Into sub_prof (InstanceID, ProfileId) VALUES (-5, 0); -- new user
  111. Insert Into sub_prof (InstanceID, ProfileId) VALUES (-5, 1); -- sysop
  112. Insert Into sub_prof (InstanceID, ProfileId) VALUES (-5, 2); -- guest
  113. Insert Into Area_Sub (AreaId, InstanceId) VALUES (0, -5);
  114.  
  115.  
  116.