Schema - UJPyon/behold GitHub Wiki
Database Schema
Users
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
fname | string | not null |
lname | string | not null |
string | not null, indexed, unique | |
password_digest | string | not null |
session_token | string | not null, indexed, unique |
text | string | |
created_at | datetime | not null |
updated_at | datetime | not null |
- index on
email, unique: true
- index on
session_token, unique: true
Projects
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
title | string | not null |
description | string | not null |
artist_id | integer | not null, indexed, unique |
created_at | datetime | not null |
updated_at | datetime | not null |
- index on
artist_id, unique: true
Comments
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
author_id | integer | not null, indexed, unique |
body | string | not null |
project_id | integer | not null, indexed |
created_at | datetime | not null |
updated_at | datetime | not null |
- index on
author_id, unique: true
- index on
project_id
Categories
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
name | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
Joins Tables
Appreciations
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
project_id | integer | not null, indexed |
appreciator_id | integer | not null, indexed |
created_at | datetime | not null |
updated_at | datetime | not null |
- index on
project_id
- index on
appreciator_id
- index on
appreciations, [project_id, appreciator_id], unique: true
Category_projects
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
category_id | integer | not null |
project_id | integer | not null |
created_at | datetime | not null |
updated_at | datetime | not null |