r75436 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75435‎ | r75436 | r75437 >
Date:16:15, 26 October 2010
Author:greg
Status:deferred (Comments)
Tags:
Comment:
First pass at Postgres support: schema transalation only, app code not tested.
Modified paths:
  • /trunk/extensions/SocialProfile/SystemGifts/systemgifts.pg.sql (deleted) (history)
  • /trunk/extensions/SocialProfile/SystemGifts/systemgifts.postgres.sql (added) (history)
  • /trunk/extensions/SocialProfile/UserBoard/user_board.postgres.sql (added) (history)
  • /trunk/extensions/SocialProfile/UserGifts/usergifts.postgres.sql (added) (history)
  • /trunk/extensions/SocialProfile/UserProfile/user_profile.postgres.sql (added) (history)
  • /trunk/extensions/SocialProfile/UserRelationship/user_relationship.postgres.sql (added) (history)
  • /trunk/extensions/SocialProfile/UserStats/user_stats.postgres.sql (modified) (history)
  • /trunk/extensions/SocialProfile/UserSystemMessages/user_system_messages.postgres.sql (added) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/UserGifts/usergifts.postgres.sql
@@ -0,0 +1,27 @@
 2+-- Postgres version
 3+
 4+CREATE TABLE user_gift (
 5+ ug_id SERIAL PRIMARY KEY,
 6+ ug_gift_id INTEGER NOT NULL DEFAULT 0,
 7+ ug_user_id_to INTEGER NOT NULL DEFAULT 0,
 8+ ug_user_name_to TEXT NOT NULL DEFAULT '',
 9+ ug_user_id_from INTEGER NOT NULL DEFAULT 0,
 10+ ug_user_name_from TEXT NOT NULL DEFAULT '',
 11+ ug_status INTEGER DEFAULT 1,
 12+ ug_type INTEGER,
 13+ ug_message TEXT,
 14+ ug_date TIMESTAMPTZ NOT NULL DEFAULT now()
 15+);
 16+CREATE INDEX social_profile_ug_user_id_from ON user_gift(ug_user_id_from);
 17+CREATE INDEX social_profile_ug_user_id_to ON user_gift(ug_user_id_to);
 18+
 19+CREATE TABLE gift (
 20+ gift_id SERIAL PRIMARY KEY,
 21+ gift_access INTEGER NOT NULL DEFAULT 0,
 22+ gift_creator_user_id INTEGER NOT NULL DEFAULT 0,
 23+ gift_creator_user_name TEXT NOT NULL DEFAULT '',
 24+ gift_name TEXT NOT NULL DEFAULT '',
 25+ gift_description TEXT,
 26+ gift_given_count INTEGER DEFAULT 0,
 27+ gift_createdate TIMESTAMPTZ NOT NULL DEFAULT now()
 28+);
Index: trunk/extensions/SocialProfile/UserSystemMessages/user_system_messages.postgres.sql
@@ -0,0 +1,11 @@
 2+-- Postgres version
 3+
 4+CREATE TABLE user_system_messages (
 5+ um_id SERIAL PRIMARY KEY,
 6+ um_user_id INTEGER NOT NULL DEFAULT 0,
 7+ um_user_name TEXT NOT NULL DEFAULT '',
 8+ um_message TEXT NOT NULL DEFAULT '',
 9+ um_type INTEGER DEFAULT 0,
 10+ um_date TIMESTAMPTZ NOT NULL DEFAULT now()
 11+);
 12+CREATE INDEX social_profile_usm_user_id ON user_system_messages(um_user_id);
Index: trunk/extensions/SocialProfile/UserStats/user_stats.postgres.sql
@@ -1,49 +1,47 @@
 2+-- Postgres version
23
34 CREATE TABLE user_stats (
4 - stats_user_id INTEGER PRIMARY KEY NOT NULL DEFAULT 0,
5 - stats_year_id INTEGER NOT NULL DEFAULT 0,
6 - stats_user_name TEXT NOT NULL DEFAULT '',
7 - stats_user_image_count INTEGER NOT NULL DEFAULT 0,
8 - stats_comment_count INTEGER NOT NULL DEFAULT 0,
9 - stats_comment_score INTEGER NOT NULL DEFAULT 0,
10 - stats_comment_score_positive_rec INTEGER NOT NULL DEFAULT 0,
11 - stats_comment_score_negative_rec INTEGER NOT NULL DEFAULT 0,
12 - stats_comment_score_positive_given INTEGER NOT NULL DEFAULT 0,
13 - stats_comment_score_negative_given INTEGER NOT NULL DEFAULT 0,
14 - stats_comment_blocked INTEGER NOT NULL DEFAULT 0,
15 - stats_vote_count INTEGER NOT NULL DEFAULT 0,
16 - stats_edit_count INTEGER NOT NULL DEFAULT 0,
17 - stats_opinions_created INTEGER NOT NULL DEFAULT 0,
18 - stats_opinions_published INTEGER NOT NULL DEFAULT 0,
19 - stats_referrals INTEGER NOT NULL DEFAULT 0,
20 - stats_referrals_completed INTEGER NOT NULL DEFAULT 0,
21 - stats_challenges_count INTEGER NOT NULL DEFAULT 0,
22 - stats_challenges_won INTEGER NOT NULL DEFAULT 0,
23 - stats_challenges_rating_positive INTEGER NOT NULL DEFAULT 0,
24 - stats_challenges_rating_negative INTEGER NOT NULL DEFAULT 0,
25 - stats_friends_count INTEGER NOT NULL DEFAULT 0,
26 - stats_foe_count INTEGER NOT NULL DEFAULT 0,
27 - stats_gifts_rec_count INTEGER NOT NULL DEFAULT 0,
28 - stats_gifts_sent_count INTEGER NOT NULL DEFAULT 0,
29 - stats_weekly_winner_count INTEGER NOT NULL DEFAULT 0,
30 - stats_monthly_winner_count INTEGER NOT NULL DEFAULT 0,
31 - stats_total_points INTEGER DEFAULT 0,
32 - stats_overall_rank INTEGER NOT NULL DEFAULT 0,
 5+ stats_user_id INTEGER NOT NULL DEFAULT 0 PRIMARY KEY,
 6+ stats_year_id INTEGER NOT NULL DEFAULT 0,
 7+ stats_user_name TEXT NOT NULL DEFAULT '',
 8+ stats_user_image_count INTEGER NOT NULL DEFAULT 0,
 9+ stats_comment_count INTEGER NOT NULL DEFAULT 0,
 10+ stats_comment_score INTEGER NOT NULL DEFAULT 0,
 11+ stats_comment_score_positive_rec INTEGER NOT NULL DEFAULT 0,
 12+ stats_comment_score_negative_rec INTEGER NOT NULL DEFAULT 0,
 13+ stats_comment_score_positive_given INTEGER NOT NULL DEFAULT 0,
 14+ stats_comment_score_negative_given INTEGER NOT NULL DEFAULT 0,
 15+ stats_comment_blocked INTEGER NOT NULL DEFAULT 0,
 16+ stats_vote_count INTEGER NOT NULL DEFAULT 0,
 17+ stats_edit_count INTEGER NOT NULL DEFAULT 0,
 18+ stats_opinions_created INTEGER NOT NULL DEFAULT 0,
 19+ stats_opinions_published INTEGER NOT NULL DEFAULT 0,
 20+ stats_referrals INTEGER NOT NULL DEFAULT 0,
 21+ stats_referrals_completed INTEGER NOT NULL DEFAULT 0,
 22+ stats_challenges_count INTEGER NOT NULL DEFAULT 0,
 23+ stats_challenges_won INTEGER NOT NULL DEFAULT 0,
 24+ stats_challenges_rating_positive INTEGER NOT NULL DEFAULT 0,
 25+ stats_challenges_rating_negative INTEGER NOT NULL DEFAULT 0,
 26+ stats_friends_count INTEGER NOT NULL DEFAULT 0,
 27+ stats_foe_count INTEGER NOT NULL DEFAULT 0,
 28+ stats_gifts_rec_count INTEGER NOT NULL DEFAULT 0,
 29+ stats_gifts_sent_count INTEGER NOT NULL DEFAULT 0,
 30+ stats_weekly_winner_count INTEGER NOT NULL DEFAULT 0,
 31+ stats_monthly_winner_count INTEGER NOT NULL DEFAULT 0,
 32+ stats_total_points INTEGER DEFAULT 0,
 33+ stats_overall_rank INTEGER NOT NULL DEFAULT 0,
3334 up_complete INTEGER,
34 - user_board_count INTEGER DEFAULT 0,
35 - user_board_sent INTEGER DEFAULT 0,
36 - user_board_count_priv INTEGER DEFAULT 0,
37 - stats_picturegame_votes INTEGER DEFAULT 0,
38 - stats_picturegame_created INTEGER DEFAULT 0,
39 - user_status_count INTEGER DEFAULT 0,
40 - stats_poll_votes INTEGER DEFAULT 0,
41 - user_status_agree INTEGER DEFAULT 0,
42 - stats_quiz_questions_answered INTEGER DEFAULT 0,
43 - stats_quiz_questions_correct INTEGER DEFAULT 0,
44 - stats_quiz_points INTEGER DEFAULT 0,
45 - stats_quiz_questions_created INTEGER DEFAULT 0,
46 - stats_quiz_questions_correct_percent FLOAT DEFAULT 0t
 35+ user_board_count INTEGER DEFAULT 0,
 36+ user_board_sent INTEGER DEFAULT 0,
 37+ user_board_count_priv INTEGER DEFAULT 0,
 38+ stats_picturegame_votes INTEGER DEFAULT 0,
 39+ stats_picturegame_created INTEGER DEFAULT 0,
 40+ user_status_count INTEGER DEFAULT 0,
 41+ stats_poll_votes INTEGER DEFAULT 0,
 42+ user_status_agree INTEGER DEFAULT 0,
 43+ stats_quiz_questions_answered INTEGER DEFAULT 0,
 44+ stats_quiz_questions_correct INTEGER DEFAULT 0,
 45+ stats_quiz_points INTEGER DEFAULT 0,
 46+ stats_quiz_questions_created INTEGER DEFAULT 0,
 47+ stats_quiz_questions_correct_percent FLOAT DEFAULT 0
4748 );
Index: trunk/extensions/SocialProfile/UserProfile/user_profile.postgres.sql
@@ -0,0 +1,36 @@
 2+-- Postgres version
 3+
 4+CREATE TABLE user_profile (
 5+ up_user_id INTEGER NOT NULL DEFAULT 0 PRIMARY KEY,
 6+ up_location_city TEXT,
 7+ up_location_state TEXT,
 8+ up_location_country TEXT,
 9+ up_hometown_city TEXT,
 10+ up_hometown_state TEXT,
 11+ up_hometown_country TEXT,
 12+ up_birthday DATE,
 13+ up_relationship INTEGER NOT NULL DEFAULT 0,
 14+ up_occupation TEXT DEFAULT '',
 15+ up_companies TEXT,
 16+ up_about TEXT,
 17+ up_places_lived TEXT,
 18+ up_schools TEXT,
 19+ up_websites TEXT,
 20+ up_movies TEXT,
 21+ up_books TEXT,
 22+ up_magazines TEXT,
 23+ up_music TEXT,
 24+ up_tv TEXT,
 25+ up_drinks TEXT,
 26+ up_snacks TEXT,
 27+ up_video_games TEXT,
 28+ up_interests TEXT,
 29+ up_quotes TEXT,
 30+ up_custom_1 TEXT,
 31+ up_custom_2 TEXT,
 32+ up_custom_3 TEXT,
 33+ up_custom_4 TEXT,
 34+ up_custom_5 TEXT,
 35+ up_last_seen TIMESTAMPTZ NOT NULL DEFAULT now(),
 36+ up_type INTEGER NOT NULL DEFAULT 1
 37+);
Index: trunk/extensions/SocialProfile/UserRelationship/user_relationship.postgres.sql
@@ -0,0 +1,27 @@
 2+-- Postgres version
 3+
 4+CREATE TABLE user_relationship (
 5+ r_id SERIAL PRIMARY KEY,
 6+ r_user_id INTEGER NOT NULL DEFAULT 0,
 7+ r_user_name TEXT NOT NULL DEFAULT '',
 8+ r_user_id_relation INTEGER NOT NULL DEFAULT 0,
 9+ r_user_name_relation TEXT NOT NULL DEFAULT '',
 10+ r_type INTEGER,
 11+ r_date TIMESTAMPTZ NOT NULL DEFAULT now()
 12+);
 13+CREATE INDEX social_profile_ur_user_id ON user_relationship(r_user_id);
 14+CREATE INDEX social_profile_ur_user_id_relation ON user_relationship(r_user_id_relation);
 15+
 16+CREATE TABLE user_relationship_request (
 17+ ur_id SERIAL PRIMARY KEY,
 18+ ur_user_id_from INTEGER NOT NULL DEFAULT 0,
 19+ ur_user_name_from TEXT NOT NULL DEFAULT '',
 20+ ur_user_id_to INTEGER NOT NULL DEFAULT 0,
 21+ ur_user_name_to TEXT NOT NULL DEFAULT '',
 22+ ur_status INTEGER DEFAULT 0,
 23+ ur_type INTEGER,
 24+ ur_message TEXT,
 25+ ur_date TIMESTAMPTZ NOT NULL DEFAULT now()
 26+);
 27+CREATE INDEX social_profile_urr_user_id_from ON user_relationship_request(ur_user_id_from);
 28+CREATE INDEX social_profile_urr_user_id_to ON user_relationship_request(ur_user_id_to);
Index: trunk/extensions/SocialProfile/SystemGifts/systemgifts.pg.sql
@@ -1,24 +0,0 @@
2 -
3 -CREATE TABLE user_system_gift (
4 - sg_id SERIAL PRIMARY KEY,
5 - sg_gift_id INTEGER NOT NULL DEFAULT 0,
6 - sg_user_id INTEGER NOT NULL DEFAULT 0,
7 - sg_user_name TEXT NOT NULL DEFAULT '',
8 - sg_status INTEGER DEFAULT 1,
9 - sg_date TIMESTAMPTZ NOT NULL DEFAULT now()
10 -);
11 -CREATE INDEX sg_gift_id ON user_system_gift(sg_gift_id);
12 -CREATE INDEX sg_user_id ON user_system_gift(sg_user_id);
13 -
14 -CREATE TABLE system_gift (
15 - gift_id SERIAL PRIMARY KEY,
16 - gift_name TEXT NOT NULL DEFAULT '',
17 - gift_description TEXT,
18 - gift_given_count INTEGER DEFAULT 0,
19 - gift_category INTEGER DEFAULT 0,
20 - gift_threshold INTEGER DEFAULT 0,
21 - gift_createdate TIMESTAMPTZ NOT NULL DEFAULT now()
22 -);
23 -CREATE INDEX system_gift_category ON system_gift(gift_category);
24 -CREATE INDEX system_gift_threshold ON system_gift(gift_threshold);
Index: trunk/extensions/SocialProfile/SystemGifts/systemgifts.postgres.sql
@@ -0,0 +1,24 @@
 2+-- Postgres version
 3+
 4+CREATE TABLE user_system_gift (
 5+ sg_id SERIAL PRIMARY KEY,
 6+ sg_gift_id INTEGER NOT NULL DEFAULT 0,
 7+ sg_user_id INTEGER NOT NULL DEFAULT 0,
 8+ sg_user_name TEXT NOT NULL DEFAULT '',
 9+ sg_status INTEGER DEFAULT 1,
 10+ sg_date TIMESTAMPTZ NOT NULL DEFAULT now()
 11+);
 12+CREATE INDEX social_profile_usg_gift_id ON user_system_gift(sg_gift_id);
 13+CREATE INDEX social_profile_usg_user_id ON user_system_gift(sg_user_id);
 14+
 15+CREATE TABLE system_gift (
 16+ gift_id SERIAL PRIMARY KEY,
 17+ gift_name TEXT NOT NULL DEFAULT '',
 18+ gift_description TEXT,
 19+ gift_given_count INTEGER DEFAULT 0,
 20+ gift_category INTEGER DEFAULT 0,
 21+ gift_threshold INTEGER DEFAULT 0,
 22+ gift_createdate TIMESTAMPTZ NOT NULL DEFAULT now()
 23+);
 24+CREATE INDEX social_profile_sg_category ON system_gift(gift_category);
 25+CREATE INDEX social_profile_sg_threshold ON system_gift(gift_threshold);
Index: trunk/extensions/SocialProfile/UserBoard/user_board.postgres.sql
@@ -0,0 +1,15 @@
 2+-- Postgres version
 3+
 4+CREATE TABLE user_board (
 5+ ub_id SERIAL PRIMARY KEY,
 6+ ub_user_id INTEGER NOT NULL DEFAULT 0,
 7+ ub_user_name TEXT NOT NULL DEFAULT '',
 8+ ub_user_id_from INTEGER NOT NULL DEFAULT 0,
 9+ ub_user_name_from TEXT NOT NULL DEFAULT '',
 10+ ub_message TEXT NOT NULL,
 11+ ub_type INTEGER DEFAULT 0,
 12+ ub_date TIMESTAMPTZ NOT NULL DEFAULT now()
 13+);
 14+CREATE INDEX social_profile_ub_user_id ON user_board(ub_user_id);
 15+CREATE INDEX social_profile_ub_user_id_from ON user_board(ub_user_id_from);
 16+CREATE INDEX social_profile_ub_type ON user_board(ub_type);

Comments

#Comment by Jack Phoenix (talk | contribs)   16:27, 26 October 2010

Thanks!

There are some nasty usages of raw SQL in SocialProfile, at least in UserActivity stuff (UserActivityClass.php), in UserBoardClass.php (in UserBoard directory) and UserStatsClass.php (in UserStats directory). I assume that PostgreSQL won't like those...

#Comment by MarkAHershberger (talk | contribs)   04:09, 26 November 2010

see my comments on r75007 for how to fix those problems.

#Comment by MarkAHershberger (talk | contribs)   06:26, 25 November 2010

Running update.php, I get:

Creating mwuser table...PHP Warning:  pg_query(): Query failed: ERROR:  relation "user" does not exist
Query: ALTER TABLE "user" RENAME TO mwuser
#Comment by OverlordQ (talk | contribs)   06:29, 25 November 2010

You sure you tagged the right commit? I dont see anything in this that references the user table.

#Comment by MarkAHershberger (talk | contribs)   06:29, 25 November 2010

nm, my bad. not relevant here.

Status & tagging log