https://bugzilla.wikimedia.org/show_bug.cgi?id=57747

--- Comment #1 from basti <[email protected]> ---
Sorry something get wrong on my post (2013-11-29 15:23:09) here.
I try to port BlogPage to postgres and "$opinionsCreated" seems to be allways
null.

there is my postgres code i have create:

// SQL from comments-extention

-- set Schemata 
SET search_path = mediawiki;

CREATE TABLE "Comments"
(
  commentid SERIAL NOT NULL,
  Comment_Page_ID integer NOT NULL DEFAULT 0,
  Comment_user_id integer NOT NULL DEFAULT 0,
  Comment_Username varchar(200) NOT NULL DEFAULT '',
  Comment_Text text NOT NULL,
  Comment_Date timestamp without time zone NOT NULL,
  Comment_Parent_ID integer NOT NULL DEFAULT 0,
  Comment_IP varchar(45) NOT NULL DEFAULT '',
  Comment_Plus_Count integer NOT NULL DEFAULT 0,
  Comment_Minus_Count integer NOT NULL DEFAULT 0,
  CONSTRAINT comments_pkey PRIMARY KEY (commentid)
);

CREATE TABLE "Comments_Vote"
(
  comment_vote_id SERIAL PRIMARY KEY,
  Comment_Vote_user_id integer NOT NULL DEFAULT 0,
  Comment_Vote_Username varchar(200) NOT NULL DEFAULT '',
  Comment_Vote_Score integer NOT NULL DEFAULT 0,
  Comment_Vote_Date timestamp without time zone NOT NULL,
  Comment_Vote_IP varchar(45) NOT NULL DEFAULT ''
);

CREATE TABLE "Comments_block" (
  cb_id SERIAL PRIMARY KEY,
  cb_user_id integer NOT NULL default '0',
  cb_user_name varchar(255) NOT NULL default '',
  cb_user_id_blocked integer default NULL,
  cb_user_name_blocked varchar(255) NOT NULL default '',
  cb_date timestamp without time zone NOT NULL
);

-- set rights to the wikiuser, replace my_wikiuser with your defined database
username

ALTER TABLE mediawiki."Comments"
  OWNER TO my_wikiuser;

ALTER TABLE mediawiki."Comments_Vote"
  OWNER TO my_wikiuser;

ALTER TABLE mediawiki."Comments_block"
  OWNER TO my_wikiuser;

-- maybe some more mysqlcompat functions are need
-- http://pgfoundry.org/projects/mysqlcompat/

-- or http://okbob.blogspot.de/2009/08/mysql-functions-for-postgresql.html

CREATE OR REPLACE FUNCTION ifnull(anyelement, anyelement)
  RETURNS anyelement AS
$BODY$
  SELECT COALESCE($1, $2)
$BODY$
  LANGUAGE sql IMMUTABLE

//END SQL from comments-extention

// SQL from SocialProfile/UserStats extention

-- Postgres version

CREATE TABLE user_stats (
  stats_user_id                        INTEGER  NOT NULL  DEFAULT 0  PRIMARY
KEY,
  stats_year_id                        INTEGER  NOT NULL  DEFAULT 0,
  stats_user_name                      TEXT     NOT NULL  DEFAULT '',
  stats_user_image_count               INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_count                  INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score                  INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_positive_rec     INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_negative_rec     INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_positive_given   INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_negative_given   INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_blocked                INTEGER  NOT NULL  DEFAULT 0,
  stats_vote_count                     INTEGER  NOT NULL  DEFAULT 0,
  stats_edit_count                     INTEGER  NOT NULL  DEFAULT 0,
  stats_opinions_created               INTEGER  NOT NULL  DEFAULT 0,
  stats_opinions_published             INTEGER  NOT NULL  DEFAULT 0,
  stats_referrals                      INTEGER  NOT NULL  DEFAULT 0,
  stats_referrals_completed            INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_count               INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_won                 INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_rating_positive     INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_rating_negative     INTEGER  NOT NULL  DEFAULT 0,
  stats_friends_count                  INTEGER  NOT NULL  DEFAULT 0,
  stats_foe_count                      INTEGER  NOT NULL  DEFAULT 0,
  stats_gifts_rec_count                INTEGER  NOT NULL  DEFAULT 0,
  stats_gifts_sent_count               INTEGER  NOT NULL  DEFAULT 0,
  stats_weekly_winner_count            INTEGER  NOT NULL  DEFAULT 0,
  stats_monthly_winner_count           INTEGER  NOT NULL  DEFAULT 0,
  stats_total_points                   INTEGER            DEFAULT 0,
  stats_overall_rank                   INTEGER  NOT NULL  DEFAULT 0,
  up_complete                          INTEGER,
  user_board_count                     INTEGER           DEFAULT 0,
  user_board_sent                      INTEGER           DEFAULT 0,
  user_board_count_priv                INTEGER           DEFAULT 0,
  stats_picturegame_votes              INTEGER           DEFAULT 0,
  stats_picturegame_created            INTEGER           DEFAULT 0,
  user_status_count                    INTEGER           DEFAULT 0,
  stats_poll_votes                     INTEGER           DEFAULT 0,
  user_status_agree                    INTEGER           DEFAULT 0,
  stats_quiz_questions_answered        INTEGER           DEFAULT 0,
  stats_quiz_questions_correct         INTEGER           DEFAULT 0,
  stats_quiz_points                    INTEGER           DEFAULT 0,
  stats_quiz_questions_created         INTEGER           DEFAULT 0,
  stats_quiz_questions_correct_percent FLOAT             DEFAULT 0,
  stats_links_submitted                INTEGER  NOT NULL DEFAULT 0,
  stats_links_approved                 INTEGER  NOT NULL DEFAULT 0
);


-- perhaps this belong to RandomFeaturedUser ?
-- user_points_weekly table
--
https://github.com/svn2github/wikia/blob/master/extensions/RandomFeaturedUser/

-- set Schemata
SET search_path = mediawiki;

-- user_points_weekly
CREATE TABLE /*_*/user_points_weekly (
  up_id serial NOT NULL PRIMARY KEY,
  up_user_id integer NOT NULL default '0',
  up_user_name varchar(255) NOT NULL default '',
  up_points float NOT NULL default '0'
) /*$wgDBTableOptions*/;

CREATE INDEX /*i*/up_user_id ON /*_*/user_points_weekly (up_user_id);
ALTER TABLE mediawiki."user_points_weekly" OWNER TO my_wikiuser;

-- user_points_monthly
CREATE TABLE /*_*/user_points_monthly (
  `up_id` int(11) NOT NULL auto_increment PRIMARY KEY,
  `up_user_id` int(11) NOT NULL default '0',
  `up_user_name` varchar(255) NOT NULL default '',
  `up_points` float NOT NULL default '0'
) /*$wgDBTableOptions*/;

CREATE INDEX /*i*/up_user_id ON /*_*/user_points_monthly (up_user_id);
ALTER TABLE mediawiki."user_points_monthly" OWNER TO my_wikiuser;

-- user_points_archive
CREATE TABLE /*_*/user_points_archive (
  up_id serial NOT NULL PRIMARY KEY,
  up_period integer NOT NULL default '0',
  up_date timestamp without time zone NOT NULL,
  up_user_id integer NOT NULL default '0',
  up_user_name varchar(255) NOT NULL,
  up_points float NOT NULL default '0'
) /*$wgDBTableOptions*/;

CREATE INDEX up_user_id_archive ON user_points_archive (up_user_id);
ALTER TABLE mediawiki."user_points_archive" OWNER TO my_wikiuser;

//END SQL from SocialProfile/UserStats extention


// SQL from VoteNY extention

-- Postgres Version
-- author: Sebastian Fiedler

-- set Schemata
SET search_path = mediawiki;

CREATE TABLE "Vote" (
  -- Internal ID to identify between different vote tags on different pages
  vote_id SERIAL NOT NULL PRIMARY KEY,
  -- Username (if any) of the person who voted
  username varchar(255) NOT NULL default '0',
  -- User ID of the person who voted
  vote_user_id integer NOT NULL default '0',
  -- ID of the page where the vote tag is in
  vote_page_id integer NOT NULL default '0',
  -- Value of the vote (ranging from 1 to 5)
  vote_value char(1) NOT NULL default '',
  -- Timestamp when the vote was cast
  vote_date timestamp without time zone NOT NULL,
  -- IP address of the user who voted
  vote_ip varchar(45) NOT NULL default ''
) /*$wgDBTableOptions*/;

CREATE INDEX vote_page_id_index ON "Vote" (vote_page_id);
CREATE INDEX valueidx ON "Vote" (vote_value);
CREATE INDEX usernameidx ON "Vote" (username);
CREATE INDEX vote_date ON "Vote" (vote_date);


// END SQL from VoteNY extention

Have I forgot something?
Do not hesitate to contact me.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to