mirror of
https://github.com/MariaDB/server.git
synced 2025-12-04 17:23:46 +03:00
39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
DROP TABLE IF EXISTS stories;
|
|
CREATE TABLE stories (
|
|
sid char(16) NOT NULL,
|
|
tid smallint UNSIGNED NOT NULL,
|
|
uid mediumint UNSIGNED NOT NULL,
|
|
title varchar(100) DEFAULT '' NOT NULL,
|
|
dept varchar(100),
|
|
time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
|
|
hits mediumint UNSIGNED DEFAULT '0' NOT NULL,
|
|
section varchar(30) DEFAULT '' NOT NULL,
|
|
displaystatus tinyint DEFAULT '0' NOT NULL,
|
|
commentstatus tinyint,
|
|
discussion mediumint UNSIGNED,
|
|
submitter mediumint UNSIGNED NOT NULL,
|
|
flags set("delete_me","data_dirty") DEFAULT '' NOT NULL,
|
|
PRIMARY KEY (sid),
|
|
FOREIGN KEY (uid) REFERENCES users(uid),
|
|
FOREIGN KEY (tid) REFERENCES tid(topic),
|
|
FOREIGN KEY (section) REFERENCES sections(section),
|
|
KEY time (time),
|
|
KEY searchform (displaystatus,time)
|
|
) TYPE = myisam;
|
|
DROP TABLE IF EXISTS story_text;
|
|
CREATE TABLE story_text (
|
|
sid char(16) NOT NULL,
|
|
introtext text,
|
|
bodytext text,
|
|
relatedtext text,
|
|
FOREIGN KEY (sid) REFERENCES stories(sid),
|
|
PRIMARY KEY (sid)
|
|
) TYPE = myisam;
|
|
ALTER TABLE stories add fulltext (title);
|
|
ALTER TABLE story_text add fulltext (introtext,bodytext);
|
|
|
|
SELECT stories.sid,title, TRUNCATE((MATCH (title,introtext,bodytext)
|
|
AGAINST('install')), 1) as score FROM stories,story_text WHERE
|
|
stories.sid = story_text.sid AND MATCH (title,introtext,bodytext)
|
|
AGAINST ('install');
|