Database Schema - gmiddle/ignored GitHub Wiki

users
| column name |
data type |
details |
| id |
int |
primary key |
| email |
string(256) |
Not Null |
| hashedPassword |
string |
|
| username |
string(30) |
Not Null |
| profilePic |
string |
|
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| privateServerId |
int |
relationship |
- privateServerId references private_servers table(Id)
servers
| column name |
data type |
details |
| id |
int |
primary key |
| name |
string(80) |
Not Null |
| description |
string(750) |
Not Null |
| serverImg |
string |
|
| serverInviteKey |
string |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| ownerId |
int |
FK Not Null |
- Id references channels table(serverId)
- Id references Users table(users.id)
private_servers
| column name |
data type |
details |
| id |
int |
primary key |
| name |
string(80) |
Not Null |
| description |
string(750) |
Not Null |
| serverImg |
string |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
- Id references Users table(PrivateServersList)
- Id references Private_Channels table(ServerId)
channels
| column name |
data type |
details |
| id |
int |
primary key |
| name |
string(80) |
Not Null |
| topic |
string(80) |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| channelId |
int |
FK Not Null |
- Id references Messages table(ChannelId)
messages
| column name |
data type |
details |
| id |
int |
primary key |
| content |
string(2000) |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| channelId |
int |
FK Not Null |
| userId |
int |
FK Not Null |
- ChannelId references Messages table(ChannelsId)
- UserId references Users table(usersId)
friendships
| column name |
data type |
details |
| id |
int |
primary key |
| inviteId |
string |
Not Null |
| accepted |
boolean |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| userId |
int |
Foreign Key |
| followerId |
int |
Foreign Key |
- UserId references Users table(UserId)
- FolloweId references Users table(usersId)
private_channels
| column name |
data type |
details |
| id |
int |
primary key |
| name |
string(80) |
Not Null |
| topic |
string(80) |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| serverId |
int |
Foreign Key |
- ServerId references Private_Servers table(PrivateServersId)
private_messages
| column name |
data type |
details |
| id |
int |
primary key |
| content |
string(2000) |
Not Null |
| createdAt |
timestamp |
|
| updatedAt |
timestamp |
|
| channelId |
int |
Foreign Key |
| userId |
int |
Foreign Key |
- ChannelId references PrivateChannels table(PrivateChannelId)
- UserId references Users table(usersId)