diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2018-08-31 00:54:19 -0400 |
|---|---|---|
| committer | Kevin Hoerr <kjhoerr@submelon.tech> | 2018-08-31 23:24:45 -0400 |
| commit | ce68cc32e95a875ee5af40c429c9bbe191997394 (patch) | |
| tree | bd958d3fb44cd4cc29c7f2a57f0f4390d716eee8 /src | |
| parent | 2463916a5c3f25f3d584aacb8b40130c13619ba1 (diff) | |
| download | august-offensive-ce68cc32e95a875ee5af40c429c9bbe191997394.tar.gz august-offensive-ce68cc32e95a875ee5af40c429c9bbe191997394.tar.bz2 august-offensive-ce68cc32e95a875ee5af40c429c9bbe191997394.zip | |
Modify migration files to work seamlessly; update README.md
Diffstat (limited to 'src')
| -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, +); |
