User "Jack Phoenix" posted a comment on MediaWiki.r89497. Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89497#c17627 Commit summary:
sql request Comment: <pre> +CREATE TABLE IF NOT EXISTS `user_status` ( </pre> We don't normally include the <code>IF NOT EXISTS</code> clause in our table definitions, but I personally don't mind it. However, you should drop the `backticks` and prefix the table name with <code>/*_*/</code> for [[Manual:$wgDBprefix|database prefix]]/SQLite compatibility. <pre> + `id` int(11) NOT NULL AUTO_INCREMENT, ... + PRIMARY KEY (`id`) </pre> The <code>PRIMARY KEY</code> definition should be in the initial column definition for SQLite compatibility, like this: `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT Also, we normally prefix column fields with either the table name (if the table name is very short, such as <code>page</code>) or an abbreviation of the table name, for tables which have longer names. Admittedly, this is not true for all SocialProfile fields, because of historical reasons. Still, we shouldn't repeat mistakes made by others in the past. I'd suggest <code>us</code> as the prefix for these columns. For example: *<code>id</code> → <code>us_id</code> *<code>user_id</code> → <code>us_user_id</code> or maybe <code>us_user</code> (see for example [[Manual:Revision table|revision]].[[Manual:Revision table#rev_user|rev_user]]</code>) *<code>user_date</code> → <code>us_user_date</code> (is this the field that holds the timestamp for the status message? If so, it should probably be called <code>us_timestamp</code> or something like that for consistency; see <code>[[Manual:Revision table|revision]].[[Manual:Revision table#rev_timestamp|rev_timestamp]]</code>) *<code>user_name</code> → <code>us_user_text</code> (in core MediaWiki most fields that contain the user name are called <code>something_text</code>, for example <code>[[Manual:Revision table|revision]].[[Manual:Revision table#rev_user_text|rev_user_text]]</code>) *<code>user_status</code> → <code>us_status</code> or maybe even <code>us_status_text</code> (also, is <code>text</code> the correct type here? IIRC SocialProfile uses text for a few columns, but core MediaWiki doesn't...maybe it's not such a big deal.) _______________________________________________ MediaWiki-CodeReview mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview
