Skip to content

Commit

Permalink
Improve Tweeter table field names.
Browse files Browse the repository at this point in the history
  • Loading branch information
dom96 committed Jun 19, 2016
1 parent a9c438f commit 3e557b3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Chapter7/Tweeter/src/database.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ proc setup*(database: Database) =
database.db.exec(sql"""
CREATE TABLE IF NOT EXISTS Following(
follower text,
username text,
PRIMARY KEY (follower, username),
followed_user text,
PRIMARY KEY (follower, followed_user),
FOREIGN KEY (follower) REFERENCES User(username),
FOREIGN KEY (username) REFERENCES User(username)
FOREIGN KEY (followed_user) REFERENCES User(username)
);
""")

Expand Down Expand Up @@ -90,4 +90,4 @@ proc findMessages*(database: Database, usernames: seq[string],
"ORDER BY time DESC LIMIT " & $limit),
usernames)
for row in messages:
result.add(Message(username: row[0], time: fromSeconds(row[1].parseInt), msg: row[2]))
result.add(Message(username: row[0], time: fromSeconds(row[1].parseInt), msg: row[2]))

0 comments on commit 3e557b3

Please sign in to comment.