Clayプラグイン上で「SQLスクリプトの作成」を選ぶと以下のようなDDLファイルが作成されます。エライぞClay!
デフォルトで作成されるのは InnoDB なので、Tritonn が使えるように MyISAM に書き換えます。そして、ITEM の description に検索インデックスを貼ります。
CREATE TABLE RSS.CHANNEL (
id INTEGER NOT NULL AUTO_INCREMENT
, create_on DATETIME
, update_on DATETIME
, enable BOOL NOT NULL DEFAULT true
, title VARCHAR(255) NOT NULL
, url VARCHAR(255) NOT NULL
, format CHAR(10) NOT NULL
, category CHAR(10) NOT NULL
, PRIMARY KEY (id)
)ENGINE = MyISAM DEFAULT CHARSET utf8;
CREATE TABLE RSS.ITEM (
id INTEGER NOT NULL AUTO_INCREMENT
, create_on DATETIME
, update_on DATETIME
, enable BOOL NOT NULL DEFAULT true
, channel_id INTEGER NOT NULL
, title VARCHAR(255) NOT NULL
, description TEXT NOT NULL
, url VARCHAR(255) NOT NULL
, PRIMARY KEY (id)
, INDEX (channel_id)
, FULLTEXT INDEX idx (description)
, CONSTRAINT FK_ITEM_TO_CHANNEL FOREIGN KEY (channel_id)
REFERENCES RSS.CHANNEL (id) ON DELETE CASCADE ON UPDATE CASCADE
)ENGINE = MyISAM DEFAULT CHARSET utf8;
kagyuu@grape:~> /usr/local/mysql/bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.0.37 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create database RSS; Query OK, 1 row affected (0.07 sec) mysql> grant all on RSS.* to RSS_USER IDENTIFIED BY 'RSSPASS'; Query OK, 0 rows affected (0.05 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
kagyuu@grape:~> /usr/local/mysql/bin/mysql -u RSS_USER -p < RSS.sql Enter password:
kagyuu@grape:~> /usr/local/mysql/bin/mysql -u RSS_USER -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 15 Server version: 5.0.37 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use RSS; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show tables; +---------------+ | Tables_in_RSS | +---------------+ | CHANNEL | | ITEM | +---------------+ 2 rows in set (0.00 sec) mysql>