Skip to content

Instantly share code, notes, and snippets.

@butlerx
Last active April 1, 2018 20:44
Show Gist options
  • Save butlerx/cda69a24d5f6187c7683161863985fa8 to your computer and use it in GitHub Desktop.
Save butlerx/cda69a24d5f6187c7683161863985fa8 to your computer and use it in GitHub Desktop.
db schema
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