Schema - Gargar77/CleanTrac GitHub Wiki
Postgres Database Schema
companies
| column name |
data type |
details |
| id |
integer |
not null, primary key |
| name |
string |
not null |
| website |
string |
|
| created_at |
datetime |
not null |
| updated_at |
datetime |
not null |
users
| column name |
data type |
details |
| id |
integer |
not null, primary key |
| company_id |
integer |
not null, foreign key |
| first_name |
string |
not null |
| last_name |
string |
not null |
| phone |
string |
not null |
| email |
string |
not null,indexed |
| password_digest |
string |
not null |
| session_token |
string |
not null, indexed |
| role |
string |
not null |
| created_at |
string |
not null |
| updated_at |
string |
not null |
- comany_id references companies
accounts
| column name |
data type |
details |
| id |
integer |
not null |
| company_id |
integer |
not null, foreign key |
| name |
string |
not null |
| address |
string |
not null, indexed |
| primary_contact_name |
string |
not null, indexed |
| primary_contact_phone |
string |
not null |
| monday_cleaning |
boolean |
not null |
| tuesday_cleaning |
boolean |
not null |
| wednesday_cleaning |
boolean |
not null |
| thursday_cleaning |
boolean |
not null |
| friday_cleaning |
boolean |
not null |
| saturday_cleaning |
boolean |
not null |
| sunday_cleaning |
boolean |
not null |
| cleaning_timeframe_start |
time |
|
| cleaning_timeframe_end |
time |
|
| created_at |
datetime |
not null |
| updated_at |
datetime |
not null |
- company_id references companies
active_cleanings
| column name |
data type |
details |
| id |
integer |
not null, primary key |
| account_id |
integer |
not null, foreign key |
| user_id |
integer |
not null, foreign_key |
- a joins table to track employees to a specific account
- account_id references accounts
- user_id references users
file_links
| column name |
data type |
details |
| uploader_id |
integer |
not null |
| account_id |
integer |
not null |
| link |
text |
not null |
- this table handles uploaded content by user from a specific account
- uploader_id references users
- account_id references accounts