-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppDatabase.sql
More file actions
33 lines (30 loc) · 982 Bytes
/
AppDatabase.sql
File metadata and controls
33 lines (30 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Setup file for project database */
create user if not exists 'appserver'@'localhost' identified by 'team7';
drop database if exists AppDb;
create database AppDb;
grant all privileges on AppDb.* to 'appserver'@'localhost' identified by 'team7';
/* Table creation */
use AppDb;
create table if not exists users (
userId int not null auto_increment primary key,
fullName varchar( 128 ),
password varchar( 256 ),
lastNotification int default 0
);
create table if not exists messages (
msgId int not null auto_increment primary key,
posterId int not null,
wallOwnerId int not null,
posterName varchar( 128 ),
wallOwnerName varchar( 128 ),
msg varchar( 4095 ),
created datetime,
foreign key fkPoster(posterId)
references users(userId)
on update cascade
on delete restrict,
foreign key fkWallOwner(wallOwnerId)
references users(userId)
on update cascade
on delete restrict
);