mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
added db Folder for db stuff
This commit is contained in:
parent
3c0395c815
commit
8e3ba1afab
2 changed files with 71 additions and 0 deletions
BIN
code/db/ERP.png
Normal file
BIN
code/db/ERP.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 201 KiB |
71
code/db/README.md
Normal file
71
code/db/README.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
This is DBML Code. It can be edited and viewed on [dbdiagram.io](https://dbdiagram.io/d)
|
||||
|
||||
```
|
||||
// Use DBML to define your database structure
|
||||
// Docs: https://dbml.dbdiagram.io/docs
|
||||
|
||||
Table follows {
|
||||
following_user_id integer
|
||||
followed_user_id integer
|
||||
created_at timestamp
|
||||
}
|
||||
|
||||
Table users {
|
||||
id integer [primary key]
|
||||
username varchar [unique]
|
||||
role varchar
|
||||
email string
|
||||
password string
|
||||
created_at timestamp
|
||||
}
|
||||
|
||||
Table posts {
|
||||
id integer [primary key]
|
||||
title varchar
|
||||
body text [note: 'Content of the post']
|
||||
user_id integer [not null]
|
||||
status varchar
|
||||
file string
|
||||
created_at timestamp
|
||||
}
|
||||
|
||||
Table comments {
|
||||
id integer [primary key]
|
||||
post_id integer
|
||||
content string
|
||||
created_at timestamp
|
||||
}
|
||||
Table likes {
|
||||
id integer [primary key]
|
||||
post_id integer
|
||||
user_id integer
|
||||
created_at timestamp
|
||||
|
||||
}
|
||||
Table tags {
|
||||
id integer [primary key]
|
||||
name varchar [unique]
|
||||
}
|
||||
|
||||
Table post_tags {
|
||||
post_id integer
|
||||
tag_id integer
|
||||
}
|
||||
|
||||
Ref: post_tags.post_id > posts.id
|
||||
Ref: post_tags.tag_id > tags.id
|
||||
|
||||
|
||||
Ref: likes.user_id < users.id
|
||||
|
||||
Ref: likes.post_id < posts.id
|
||||
|
||||
Ref: posts.id < comments.post_id
|
||||
|
||||
Ref user_posts: posts.user_id > users.id // many-to-one
|
||||
|
||||
Ref: users.id < follows.following_user_id
|
||||
|
||||
Ref: users.id < follows.followed_user_id
|
||||
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue