Begin fleshing out user permissions
This commit is contained in:
		
							parent
							
								
									79d5dd5f06
								
							
						
					
					
						commit
						4133d72eb4
					
				
					 1 changed files with 28 additions and 9 deletions
				
			
		|  | @ -1,14 +1,5 @@ | |||
| begin transaction; | ||||
| 
 | ||||
| create server_user ( | ||||
|     id       INTEGER PRIMARY KEY NOT NULL, | ||||
|     active   BOOLEAN NOT NULL DEFAULT TRUE, | ||||
|     username TEXT NOT NULL, | ||||
|     password TEXT, | ||||
|     fullname TEXT, | ||||
|     mail     TEXT NOT NULL | ||||
| ); | ||||
| 
 | ||||
| create table newsgroup ( | ||||
|     id          INTEGER PRIMARY KEY NOT NULL, | ||||
|     created_on  DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||||
|  | @ -38,4 +29,32 @@ create index newsgroup_message_newsgroup_date_idx on newsgroup_message ( | |||
|     newsgroup_id, created_on | ||||
| ); | ||||
| 
 | ||||
| create table server_permission ( | ||||
|     id   INTEGER PRIMARY KEY NOT NULL, | ||||
|     name TEXT NOT NULL | ||||
| ); | ||||
| 
 | ||||
| insert into server_permission values | ||||
|     (1, 'READ'), | ||||
|     (2, 'POST'), | ||||
|     (3, 'KILL'); | ||||
| 
 | ||||
| create table server_user ( | ||||
|     id       INTEGER PRIMARY KEY NOT NULL, | ||||
|     active   BOOLEAN NOT NULL DEFAULT TRUE, | ||||
|     username TEXT NOT NULL, | ||||
|     password TEXT, | ||||
|     fullname TEXT, | ||||
|     mail     TEXT NOT NULL | ||||
| ); | ||||
| 
 | ||||
| create table server_user_permission ( | ||||
|     permission_id INTEGER NOT NULL, | ||||
|     user_id       INTEGER NOT NULL, | ||||
| 
 | ||||
|     UNIQUE(permission_id, user_id), | ||||
|     FOREIGN KEY(permission_id) REFERENCES server_permission(id), | ||||
|     FOREIGN KEY(user_id)       REFERENCES server_user(id) | ||||
| ); | ||||
| 
 | ||||
| commit; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue