SHARE
TWEET

Untitled

a guest Jun 29th, 2011 150 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE IF NOT EXISTS PrWorlds (
  2.  worldid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  3.  worldname VARCHAR(32) NOT NULL UNIQUE COMMENT 'Name of world'
  4. ) COMMENT 'World table';
  5.  
  6. CREATE TABLE IF NOT EXISTS PrEntries (
  7.  entryid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  8.  name VARCHAR(32) NOT NULLCOMMENT 'Name of user/group',
  9.  worldid INTEGER NOT NULL COMMENT 'ID of the world the user/group belongs to',
  10.  TYPE TINYINT NOT NULL COMMENT 'Type denotes the entry type. 0 for a user, 1 for a group',
  11.  CONSTRAINT NameWorld UNIQUE (name, worldid, TYPE),
  12.  ENTRYINDEX,
  13.  FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE
  14. ) COMMENT 'User/Group table';
  15.  
  16. CREATE TABLE IF NOT EXISTS PrPermissions (
  17.  permid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  18.  permstring VARCHAR(64) NOT NULL COMMENT 'Permission node',
  19.  entryid INTEGER NOT NULL COMMENT 'Entry whom this node belongs to',
  20.  CONSTRAINT PrEntryPerm UNIQUE (entryid, permstring),
  21.  FOREIGN KEY(entryid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
  22. ) COMMENT 'Table of permission nodes';
  23.  
  24. CREATE TABLE IF NOT EXISTS PrInheritance (
  25.  uinheritid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  26.  childid INTEGER NOT NULL COMMENT 'Child entry',
  27.  parentid INTEGER NOT NULL COMMENT 'Parent entry',
  28.  parentorder INTEGER NOT NULL COMMENT 'Denotes order of inheritance. Groups override other groups'' permissions/data below them in the results',
  29.  CONSTRAINT PrParent UNIQUE (childid, parentid),
  30.  CONSTRAINT PrOrderedInheritance UNIQUE (childid, parentorder),
  31.  CONSTRAINT PrNoSelfInherit CHECK (childid <> parentid),
  32.  FOREIGN KEY(childid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE,
  33.  FOREIGN KEY(parentid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
  34. ) COMMENT 'Table of parent-child relationships';
  35.  
  36. CREATE TABLE IF NOT EXISTS PrWorldBase (
  37.  worldid INTEGER NOT NULL,
  38.  defaultid INTEGER COMMENT 'Default group',
  39.  FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE,
  40.  FOREIGN KEY(defaultid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
  41. ) COMMENT 'Table of the default groups in that world';
  42.  
  43. CREATE TABLE IF NOT EXISTS PrData (
  44.  dataid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  45.  entryid INTEGER NOT NULL COMMENT 'ID entry whom this data node belongs to',
  46.  path VARCHAR(64) NOT NULL COMMENT 'Path to data node (e.g. "prefix", "build")',
  47.  DATA VARCHAR(64) NOT NULL COMMENT 'Data node in string form (o.toString())',
  48.  CONSTRAINT PrDataUnique UNIQUE (entryid, path),
  49.  FOREIGN KEY(entryid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
  50. );
  51.  
  52. CREATE TABLE IF NOT EXISTS PrTracks (
  53.  trackid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  54.  trackname VARCHAR(64) NOT NULL UNIQUE COMMENT 'Track name',
  55.  worldid INTEGER NOT NULL COMMENT 'ID of world track belongs to',
  56.  CONSTRAINT TracksUnique UNIQUE (trackid, worldid),
  57.  FOREIGN KEY(worldid) REFERENCES PrWorlds(worldid) ON DELETE CASCADE ON UPDATE CASCADE
  58. );
  59.  
  60. CREATE TABLE IF NOT EXISTS PrTrackGroups (
  61.  trackgroupid INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
  62.  trackid INTEGER NOT NULL COMMENT 'ID of track',
  63.  gid INTEGER NOT NULL COMMENT 'ID of group in track',
  64.  groupOrder INTEGER NOT NULL COMMENT 'Denotes position of the group in the track',
  65.  CONSTRAINT TrackGroupsUnique UNIQUE (trackid, gid),
  66.  FOREIGN KEY(trackid) REFERENCES PrTracks(trackid) ON DELETE CASCADE ON UPDATE CASCADE,
  67.  FOREIGN KEY(gid) REFERENCES PrEntries(entryid) ON DELETE CASCADE ON UPDATE CASCADE
  68. );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top