Last active
April 1, 2018 20:44
-
-
Save butlerx/cda69a24d5f6187c7683161863985fa8 to your computer and use it in GitHub Desktop.
db schema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
table! { | |
elections(id) { | |
id -> Integer, | |
title -> Text, | |
draft -> Bool, | |
created_at -> Timestamp, | |
started_at -> Timestamp, | |
finished_at -> Timestamp, | |
} | |
} | |
table! { | |
ballots(ballot_id) { | |
ballot_id -> Integer, | |
created_at -> Timestamp, | |
user_id -> Integer, | |
election_id -> Integer, | |
preference -> Interger, | |
candidate_id -> Interger, | |
} | |
} | |
table! { | |
users(id) { | |
id -> Integer, | |
user_name -> Text, | |
} | |
} | |
table! { | |
candidates(id) { | |
id -> Integer, | |
name -> Text, | |
password -> Text, | |
} | |
} | |
joinable!(users -> ballots(id)); | |
joinable!(elections -> ballots(id)); | |
joinable!(candidates -> ballots(id)); | |
allow_tables_to_appear_in_same_query!(elections, ballots, candidates, users); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment