Created
May 24, 2010 20:10
-
-
Save rniwa/412369 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
ENTITY sites | |
{ | |
int site_id, | |
string url, | |
int created_at, | |
int updated_at | |
PRIMARY(url) | |
} | |
ENTITY users | |
{ | |
int user_id, | |
string login, | |
string email, | |
string crypted_password, | |
string salt, | |
int created_at, | |
int updated_at, | |
string remember_token, | |
int remember_token_expires_at, | |
string activation_code, | |
int activated_at, | |
string state, | |
int deleted_at, | |
string name_prefix, | |
string name_first, | |
string name_middle, | |
string name_last, | |
int birthdate, | |
int fb_user_id, | |
string email_hash | |
PRIMARY(login) | |
} | |
ENTITY accounts | |
{ | |
int account_id, | |
string username, | |
string password, | |
int created_at, | |
int updated_at, | |
FOREIGN KEY user_id REF users, | |
FOREIGN KEY site_id REF sites, | |
string t | |
PRIMARY(username, site_id) | |
} | |
ENTITY comments | |
{ | |
int comment_id, | |
FOREIGN KEY author_id REF users, | |
string author_name, | |
string author_email, | |
string title, | |
string body, | |
int posted_at, | |
int created_at, | |
int updated_at, | |
FOREIGN KEY site_id REF sites, | |
string url, | |
string signature, | |
bool has_merit | |
PRIMARY(signature) | |
} | |
ENTITY friendships | |
{ | |
int friendship_id, | |
FOREIGN KEY user_id REF users, | |
FOREIGN KEY friend_id REF users, | |
int created_at, | |
int updated_at, | |
FOREIGN KEY site_id REF sites | |
PRIMARY(user_id, friend_id) | |
} | |
ENTITY profile_items | |
{ | |
int profile_item_id, | |
FOREIGN KEY user_id REF users, | |
FOREIGN KEY site_id REF sites, | |
string name, | |
string data, | |
int created_at, | |
int updated_at | |
PRIMARY(user_id, site_id, name) | |
} | |
ENTITY viewerships | |
{ | |
int viewership_id, | |
int rating, | |
int created_at, | |
int updated_at, | |
FOREIGN KEY user_id REF users, | |
FOREIGN KEY comment_id REF comments | |
PRIMARY(user_id, comment_id) | |
} | |
QUERY siteById | |
FETCH sites | |
WHERE site_id = [1:id] | |
LIMIT 10 MAX 10 | |
QUERY friendshipByUserAndFriend | |
FETCH friendships | |
WHERE user_id = [1:user] AND friend_id = [2:friend] | |
LIMIT 10 MAX 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment