Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5989734
tables.sql
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
tables.sql
View Options
-- SQL to create the initial tables for the MediaWiki database.
-- This is read and executed by the install script; you should
-- not have to run it by itself unless doing a manual install.
-- This is the PostgreSQL version.
-- For information about each table, please see the notes in maintenance/tables.sql
-- Please make sure all dollar-quoting uses $mw$ at the start of the line
-- TODO: Change CHAR/SMALLINT to BOOL (still used in a non-bool fashion in PHP code)
BEGIN
;
SET
client_min_messages
=
'ERROR'
;
-- Tsearch2 2 stuff. Will fail if we don't have proper access to the tsearch2 tables
-- Make sure you also change patch-tsearch2funcs.sql if the funcs below change.
ALTER
TABLE
page
ADD
titlevector
tsvector
;
CREATE
FUNCTION
ts2_page_title
()
RETURNS
TRIGGER
LANGUAGE
plpgsql
AS
$
mw$
BEGIN
IF
TG_OP
=
'INSERT'
THEN
NEW
.
titlevector
=
to_tsvector
(
REPLACE
(
NEW
.
page_title
,
'/'
,
' '
));
ELSIF
NEW
.
page_title
!=
OLD
.
page_title
THEN
NEW
.
titlevector
:
=
to_tsvector
(
REPLACE
(
NEW
.
page_title
,
'/'
,
' '
));
END
IF
;
RETURN
NEW
;
END
;
$
mw$
;
CREATE
TRIGGER
ts2_page_title
BEFORE
INSERT
OR
UPDATE
ON
page
FOR
EACH
ROW
EXECUTE
PROCEDURE
ts2_page_title
();
ALTER
TABLE
text
ADD
textvector
tsvector
;
CREATE
FUNCTION
ts2_page_text
()
RETURNS
TRIGGER
LANGUAGE
plpgsql
AS
$
mw$
BEGIN
IF
TG_OP
=
'INSERT'
THEN
NEW
.
textvector
=
to_tsvector
(
NEW
.
old_text
);
ELSIF
NEW
.
old_text
!=
OLD
.
old_text
THEN
NEW
.
textvector
:
=
to_tsvector
(
NEW
.
old_text
);
END
IF
;
RETURN
NEW
;
END
;
$
mw$
;
CREATE
TRIGGER
ts2_page_text
BEFORE
INSERT
OR
UPDATE
ON
text
FOR
EACH
ROW
EXECUTE
PROCEDURE
ts2_page_text
();
CREATE
INDEX
ts2_page_title
ON
page
USING
gin
(
titlevector
);
CREATE
INDEX
ts2_page_text
ON
text
USING
gin
(
textvector
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 01:14 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
30/2d/7cc748f6e93d52e13aef7c77ae55
Default Alt Text
tables.sql (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment