Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Deber SQL PostgreSQL
Deber SQL PostgreSQL
Table posts {
id SERIAL [pk, increment]
created_at TIMESTAMP
updated_at TIMESTAMP
url VARCHAR(200)
user_id INTEGER [ref: > users.id]
caption VARCHAR(240)
lat REAL
lng REAL
}
Table comments {
id SERIAL [pk, increment]
created_at TIMESTAMP
updated_at TIMESTAMP
contents VARCHAR(240)
user_id INTEGER [ref: > users.id]
post_id INTEGER [ref: > posts.id]
}
Table likes {
id SERIAL [pk, increment]
created_at TIMESTAMP
contents VARCHAR(240)
user_id INTEGER [ref: > users.id]
comment_id INTEGER [ref: > comment.id]
post_id INTEGER [ref: > posts.id]
}
Table caption_tags {
id SERIAL [pk, increment]
created_at TIMESTAMP
user_id INTEGER [ref: > users.id]
post_id INTEGER [ref: > posts.id]
}
Table photo_tags {
id SERIAL [pk, increment]
created_at TIMESTAMP
updated_at TIMESTAMP
user_id INTEGER [ref: > users.id]
post_id INTEGER [ref: > posts.id]
x INTEGER
y INTEGER
}
Table hashtags {
id SERIAL [pk, increment]
created_at TIMESTAMP
title VARCHAR(20)
}
Table hashtags_posts {
id SERIAL [pk, increment]
post_id INTEGER [ref: > posts.id]
hashtag_id INTEGER [ref: > hashtags.id]
}
Table followers {
id SERIAL [pk, increment]
created_at TIMESTAMP
leader_id INTEGER [ref: > users.id]
follower_id INTEGER [ref: > users.id]
}