151 lines
3.0 KiB
Markdown
151 lines
3.0 KiB
Markdown
# Entity Relationship Diagram
|
|
|
|
```mermaid
|
|
erDiagram
|
|
Tenant ||--o{ TenantUserRole : has
|
|
Tenant ||--o{ InteractionType : defines
|
|
Tenant ||--o{ DonationMethod : defines
|
|
Tenant ||--o{ ElectionType : defines
|
|
Tenant ||--o{ EventType : defines
|
|
Tenant ||--o{ ParticipationType : defines
|
|
Tenant ||--o{ Voter : belongs_to
|
|
Tenant ||--o{ Event : organizes
|
|
|
|
User ||--o{ TenantUserRole : assigned_to
|
|
|
|
Voter ||--o{ VotingRecord : has
|
|
Voter ||--o{ EventParticipation : participates
|
|
Voter ||--o{ Donation : makes
|
|
Voter ||--o{ Interaction : receives
|
|
Voter ||--o{ VoterLikelihood : has
|
|
|
|
Event ||--o{ EventParticipation : includes
|
|
EventType ||--o{ Event : categorizes
|
|
|
|
InteractionType ||--o{ Interaction : categorizes
|
|
DonationMethod ||--o{ Donation : categorizes
|
|
ElectionType ||--o{ VoterLikelihood : categorizes
|
|
ParticipationType ||--o{ EventParticipation : categorizes
|
|
|
|
Tenant {
|
|
int id PK
|
|
string name
|
|
string slug
|
|
text description
|
|
datetime created_at
|
|
}
|
|
|
|
User {
|
|
int id PK
|
|
string username
|
|
string email
|
|
string first_name
|
|
string last_name
|
|
}
|
|
|
|
TenantUserRole {
|
|
int id PK
|
|
int user_id FK
|
|
int tenant_id FK
|
|
string role
|
|
}
|
|
|
|
InteractionType {
|
|
int id PK
|
|
int tenant_id FK
|
|
string name
|
|
boolean is_active
|
|
}
|
|
|
|
DonationMethod {
|
|
int id PK
|
|
int tenant_id FK
|
|
string name
|
|
boolean is_active
|
|
}
|
|
|
|
ElectionType {
|
|
int id PK
|
|
int tenant_id FK
|
|
string name
|
|
boolean is_active
|
|
}
|
|
|
|
EventType {
|
|
int id PK
|
|
int tenant_id FK
|
|
string name
|
|
boolean is_active
|
|
}
|
|
|
|
ParticipationType {
|
|
int id PK
|
|
int tenant_id FK
|
|
string name
|
|
boolean is_active
|
|
}
|
|
|
|
Voter {
|
|
int id PK
|
|
int tenant_id FK
|
|
string voter_id
|
|
string first_name
|
|
string last_name
|
|
text address
|
|
string phone
|
|
string email
|
|
string district
|
|
string precinct
|
|
date registration_date
|
|
string candidate_support
|
|
string yard_sign
|
|
datetime created_at
|
|
}
|
|
|
|
VotingRecord {
|
|
int id PK
|
|
int voter_id FK
|
|
date election_date
|
|
string election_description
|
|
string primary_party
|
|
}
|
|
|
|
Event {
|
|
int id PK
|
|
int tenant_id FK
|
|
date date
|
|
int event_type_id FK
|
|
text description
|
|
}
|
|
|
|
EventParticipation {
|
|
int id PK
|
|
int event_id FK
|
|
int voter_id FK
|
|
int participation_type_id FK
|
|
}
|
|
|
|
Donation {
|
|
int id PK
|
|
int voter_id FK
|
|
date date
|
|
int method_id FK
|
|
decimal amount
|
|
}
|
|
|
|
Interaction {
|
|
int id PK
|
|
int voter_id FK
|
|
int type_id FK
|
|
date date
|
|
string description
|
|
text notes
|
|
}
|
|
|
|
VoterLikelihood {
|
|
int id PK
|
|
int voter_id FK
|
|
int election_type_id FK
|
|
string likelihood
|
|
}
|
|
``` |