-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathERD.dbml
73 lines (66 loc) · 1.67 KB
/
ERD.dbml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Django User table (built-in)
Table User {
id integer [primary key]
username varchar
first_name varchar
last_name varchar
email varchar
password varchar
is_staff bool
// Other fields omitted for brevity
}
// Token table for authentication
Table Token {
key varchar [primary key]
user_id integer [ref: - User.id]
created timestamp
}
// ImpactPlan table
Table ImpactPlan {
id integer [primary key]
user_id integer [ref: - User.id]
annual_income decimal
philanthropy_percentage decimal
total_annual_allocation decimal
current_milestone_id integer [ref: > Milestone.id]
}
// Charity Categories
Table CharityCategory {
id integer [primary key]
name varchar
}
// Charity table
Table Charity {
id integer [primary key]
name varchar
category_id integer [ref: > CharityCategory.id]
description text
impact_metric varchar
// "impact_metric": "people given water access"
impact_ratio float
// "impact_ratio": 0.05, # This means $1 provides clean water access to 0.05 people, or $20 per person
website url
image varchar
}
// ImpactPlanCharity table
Table ImpactPlanCharity {
id integer [primary key]
impact_plan_id integer [ref: > ImpactPlan.id]
charity_id integer [ref: > Charity.id]
allocation_amount decimal
}
// Milestone table
Table Milestone {
id integer [primary key]
name varchar
description text
required_percentage decimal
image_filename varchar
}
// Relationships
Ref: Token.user_id - User.id
Ref: ImpactPlan.user_id - User.id
Ref: ImpactPlan.current_milestone_id > Milestone.id
Ref: Charity.category_id > CharityCategory.id
Ref: ImpactPlanCharity.impact_plan_id > ImpactPlan.id
Ref: ImpactPlanCharity.charity_id > Charity.id