LapisSea

Untitled

Apr 14th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 2.58 KB | None | 0 0
  1. create table AccountTypes(
  2.     id int primary key identity(0,1),
  3.    
  4.     name varchar(13) unique,
  5.  
  6.     canPost bit,
  7.  
  8.     canEditOtherPosts bit,
  9.  
  10.     canMute bit,
  11.     canBan bit,
  12.     canReport bit,
  13.     canModerateUser bit,
  14.     canViewDms bit,
  15.  
  16.     canMoveThread bit,
  17.     canModifyTopics bit,
  18.  
  19.     canPromoteUser bit,
  20.     canPromoteToAdmin bit,
  21.  
  22. )
  23. insert into AccountTypes values ('ban',          0, 0, 0,0,0,0,0, 0,0, 0,0)
  24.  
  25. insert into AccountTypes values ('basic',        1, 0, 0,0,1,0,0, 0,0, 0,0)
  26. insert into AccountTypes values ('trusted',      1, 0, 0,0,1,0,0, 0,0, 0,0)
  27.  
  28. insert into AccountTypes values ('basic-admin',  1, 1, 1,0,1,0,0, 0,0, 0,0)
  29. insert into AccountTypes values ('admin',        1, 1, 1,1,1,0,0, 0,0, 0,0)
  30. insert into AccountTypes values ('trusted-admin',1, 1, 1,1,1,0,1, 0,0, 0,0)
  31. insert into AccountTypes values ('super-admin',  1, 1, 1,1,1,1,1, 1,1, 1,1)
  32.  
  33. insert into AccountTypes values ('developer',    1, 1, 1,1,1,1,0, 1,0, 1,0)
  34. insert into AccountTypes values ('co-owner',     1, 1, 1,1,1,1,0, 1,0, 1,0)
  35. insert into AccountTypes values ('owner',        1, 1, 1,1,1,1,1, 1,1, 1,1)
  36.  
  37. create table UserMetadata(
  38.     id int primary key identity(0,1),
  39.    
  40.     name varchar,
  41.     descript varchar
  42. )
  43.  
  44. create table Users(
  45.     id int primary key identity(0,1),
  46.    
  47.     gId char(21) unique, /*google login id*/
  48.     lang nvarchar(5),
  49.     img nvarchar(512), /* user icon*/
  50.     email nvarchar(320),
  51.     nick nvarchar(32) unique, /* nickname - defaults to google name + if duplicat a hash*/
  52.     gName nvarchar(128),
  53.     banner nvarchar(256),
  54.     descipt nvarchar(2048),
  55.     hoby nvarchar(32),
  56.     note nvarchar(32),
  57.     lastAct date, /* last time active*/
  58.     joined date, /* account creation date */
  59.    
  60.     acType int foreign key references AccountTypes(id) default 1 /* type of user */
  61. )
  62.  
  63. create table Topics(
  64.  
  65.     name varchar,
  66.     broadTopic varchar,
  67.     icon varchar,
  68. )
  69.  
  70. create table Threads(
  71.     id int primary key identity(0,1),
  72.    
  73.     title nvarchar,
  74.     op int foreign key references Users(id),
  75.     creation date,
  76.     lastPost date,
  77.     visible bit default 1
  78.  
  79. )
  80.  
  81. create table Posts(
  82.     id int primary key identity(0,1),
  83.  
  84.     thread int foreign key references Threads(id),
  85.     author int foreign key references Users(id),
  86.     creation date,
  87.     lastPost date,
  88.     data nvarchar(2048),
  89.     visible bit default 1
  90. )
  91. create table Notifications(
  92.     usr int foreign key references Users(id),
  93.     thread int foreign key references Threads(id),
  94. )
  95. create table DmThread(
  96.     usr1 int foreign key references Users(id),
  97.     usr2 int foreign key references Users(id)
  98. )
  99. create table DmMsg50(
  100.     id int primary key identity(0,1),
  101.     data nvarchar /* blobs of 50 messages in json format*/
  102. )
Add Comment
Please, Sign In to add comment