-
Notifications
You must be signed in to change notification settings - Fork 103
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
avatar
association 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_id
referencesusers
- index on
[title, user_id], unique: true
-
designs
will reference bothimages
andshapes
viabgable_id
andbgable_type
- has one
thumbnail
association 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 |
-
elements
will referencebackgrounds
,shapes
,text
andimages
viaelementable_id
andelementable_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_id
referencesshape_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
thumbnail
association 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
thumbnail
association 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 |
-
images
will reference bothstock_photos
anduploaded_images
viaimageable_id
andimageable_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_id
referencesusers
- index on
[title, uploader_id], unique: true
- has one
image
association fromActiveStorage
- has one
thumbnail
association 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_id
referencesusers
- 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_connections
will reference bothdesigns
andstockphotos
viataggable_id
andtaggable_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 |
-
likes
will reference bothstock_photos
anddesigns
vialikeable_id
andlikeable_type
- index on
[user_id, likeable_id, likeable_type], unique: true
undo history(should be in front end?), how would I associate Active Storage