Skip to content

Instantly share code, notes, and snippets.

@cyberstream
Created February 8, 2012 05:50
Show Gist options
  • Save cyberstream/1765879 to your computer and use it in GitHub Desktop.
Save cyberstream/1765879 to your computer and use it in GitHub Desktop.
The SQL code for creating the ratings table for the "Fix the Web" server-side project
CREATE TABLE IF NOT EXISTS `ratings` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_foreign_key` int(11) NOT NULL COMMENT 'links this row to the report or comment in the reports table',
`username` varchar(128) NOT NULL,
`is_read` tinyint(1) NOT NULL COMMENT '0 => not read, 1 => is read',
`rating` tinyint(1) NOT NULL COMMENT '-1 => rate comment down; 0 => this is a subscription, not a rating; 1 => rate comment up',
PRIMARY KEY (`id`),
KEY `id_foreign_key` (`id_foreign_key`,`is_read`),
KEY `rating` (`rating`)
) ENGINE=InnoDB;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment