-
Notifications
You must be signed in to change notification settings - Fork 110
Schema
User info for auth
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
username |
string | not null, indexed, unique |
email |
string | not null, indexed, unique |
session_token |
string | not null, indexed, unique |
password_digest |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- has one
avatarassociation fromActiveStorage
Main CRUD feature, holding info of a single user design
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
creator_id |
integer | not null, indexed, foreign key |
folder_id |
integer | not null, indexed, foreign key |
title |
string | not null |
description |
string | |
public |
boolean | not null |
width |
float | not null |
height |
float | not null |
bgable_id |
integer | not null, indexed, foreign key |
bgable_type |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
creator_idreferencesusers - index on
[title, user_id], unique: true -
designswill reference bothimagesandshapesviabgable_idandbgable_type - has one
thumbnailassociation fromActiveStorage
Polymorphic joins table that associates designs and elements, with shared info about the object
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
design_id |
integer | not null, indexed, foreign key |
elementable_id |
integer | not null, indexed, foreign key |
elementable_type |
string | not null, indexed |
pos_x |
float | not null |
pos_y |
float | not null |
z_index |
integer | not null |
transparency |
float | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
elementswill referencebackgrounds,shapes,textandimagesviaelementable_idandelementable_type
More additional info of the element on your design that are shapes
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
template_id |
integer | not null, indexed, foreign key |
width |
float | not null |
height |
float | not null |
color |
string |
-
template_idreferencesshape_templates
The circles, rectangles... all available shapes to choose from to add to your own design (Static, Not CRUD)
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
type |
string | not null |
- has one
thumbnailassociation fromActiveStorage
More additional info of the element on your design that are text
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
font_family |
string | |
font_size |
integer | not null |
font_weight |
integer | not null |
text |
text | not null |
color |
string |
The available text templates(preset) provided to you
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
type |
string | not null |
sample_text |
string | not null |
- has one
thumbnailassociation fromActiveStorage
More additional info of the element on your design that are images(applies to both uploaded/stock images)
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
imageable_id |
integer | not null, indexed, foreign key |
imageable_type |
string | not null, indexed |
width |
float | not null |
height |
float | not null |
crop_x |
float | |
crop_y |
float |
-
imageswill reference bothstock_photosanduploaded_imagesviaimageable_idandimageable_type
Stores entries of stockphotos to choose from, not using Active Storage for image hostings with AWS
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null, indexed |
description |
string | |
thumb_url |
string | not null |
url |
string | not null |
width |
float | not null |
height |
float | not null |
Stores additional info of the Active Storage managed image library
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
title |
string | not null, indexed |
uploader_id |
integer | not null, indexed, foreign key |
width |
float | not null |
height |
float | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
uploader_idreferencesusers - index on
[title, uploader_id], unique: true - has one
imageassociation fromActiveStorage - has one
thumbnailassociation fromActiveStorage
Folder entries to organize designs
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
owner_id |
integer | not null, indexed, foreign key |
name |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
owner_idreferencesusers - index on
[name, owner_id], unique: true
Design tags examples: poster, fb_cover, buisness_card... Stockphoto tags examples: nature, portrait, food. (Do I need to seperate design/stockphoto tags, would sql query times be different?)
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed, unique |
design |
boolean | not null |
Polymorphic joins table that associates tags and designs/stockphotos
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
tag_id |
integer | not null, indexed, foreign key |
taggable_id |
integer | not null, indexed, foreign key |
taggable_type |
string | not null, indexed |
- index on
[tag_id, taggable_id, taggable_type], unique: true -
tag_connectionswill reference bothdesignsandstockphotosviataggable_idandtaggable_type
Polymorphic joins table that associates users and designs/stockphotos
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
likeable_id |
integer | not null, indexed, foreign key |
likeable_type |
string | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
likeswill reference bothstock_photosanddesignsvialikeable_idandlikeable_type - index on
[user_id, likeable_id, likeable_type], unique: true
undo history(should be in front end?), how would I associate Active Storage