diff options
Diffstat (limited to 'src/schema.rs')
| -rw-r--r-- | src/schema.rs | 112 |
1 files changed, 69 insertions, 43 deletions
diff --git a/src/schema.rs b/src/schema.rs index 2f0daba..e5d814b 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -1,66 +1,92 @@ table! { - users(userid) { - userid -> Serial, - email -> VarChar, - firstname -> VarChar, - lastname -> VarChar, - password -> VarChar, - joindate -> Date, - activated -> Bool, + activation_keys (code) { + code -> Varchar, + userid -> Int4, } } + table! { - activation_keys(code) { - code -> VarChar, - userid -> Serial, + allegiances (gameid, userid) { + gameid -> Int4, + userid -> Int4, + allegiance -> Nullable<Varchar>, + ordernum -> Int2, + playing -> Nullable<Int2>, } } + table! { - games(gameid) { - gameid -> Serial, - title -> VarChar, - gametypeid -> Serial, - players -> SmallInt, - waitfor -> Integer, - lastturn -> Date, - gamestate -> Integer, + borders (nationid, borderid) { + nationid -> Int4, + borderid -> Int4, } } + table! { - allegiances(gameid, userid) { - gameid -> Serial, - userid -> Serial, - allegiance -> VarChar, - ordernum -> SmallInt, - playing -> SmallInt, + games (gameid) { + gameid -> Int4, + title -> Varchar, + gametypeid -> Int4, + players -> Int2, + waitfor -> Int4, + lastturn -> Nullable<Date>, + gamestate -> Nullable<Int4>, } } + table! { - regions(regionid) { - regionid -> Serial, - name -> VarChar, - abbreviation -> Char, - bonus -> Integer, + games_nationstates (gameid, nationid) { + gameid -> Int4, + nationid -> Int4, + userid -> Int4, } } + table! { - nationstates(nationid) { - nationid -> Serial, - regionid -> Serial, - name -> VarChar, - abbreviation -> Char, + nationstates (nationid) { + nationid -> Int4, + regionid -> Int4, + name -> Varchar, + abbreviation -> Nullable<Bpchar>, } } + table! { - borders(nationid, borderid) { - nationid -> Serial, - borderid -> Serial, + regions (regionid) { + regionid -> Int4, + name -> Varchar, + abbreviation -> Nullable<Bpchar>, + bonus -> Int4, } } + table! { - regions_nationstates(gameid, nationid) { - gameid -> Serial, - nationid -> Serial, - userid -> Serial, + users (userid) { + userid -> Int4, + email -> Varchar, + firstname -> Varchar, + lastname -> Varchar, + password -> Varchar, + joindate -> Nullable<Date>, + activated -> Nullable<Bit>, } -}
\ No newline at end of file +} + +joinable!(activation_keys -> users (userid)); +joinable!(allegiances -> games (gameid)); +joinable!(allegiances -> users (userid)); +joinable!(games_nationstates -> games (gameid)); +joinable!(games_nationstates -> nationstates (nationid)); +joinable!(games_nationstates -> users (userid)); +joinable!(nationstates -> regions (regionid)); + +allow_tables_to_appear_in_same_query!( + activation_keys, + allegiances, + borders, + games, + games_nationstates, + nationstates, + regions, + users, +); |
