-- etsuran create
-- OpenPNE 2.4.8 ＞ OpenPNE Usagi1.1.0 convertSQL for MySQL4.1

CREATE TABLE `c_etsuran` (
 `c_etsuran_id` int(11) NOT NULL auto_increment,
 `c_member_id_from` int(11) NOT NULL default '0',
 `c_diary_id` int(11) NOT NULL default '0',
 `r_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
 PRIMARY KEY  (`c_etsuran_id`),
 KEY `c_member_id_from` (`c_member_id_from`),
 KEY `c_diary_id` (`c_diary_id`),
 KEY `c_member_from_diary_id` (`c_member_id_from`,`c_diary_id`,`r_datetime`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

ALTER TABLE `c_diary` ADD COLUMN `etsuran_count` int(11) NOT NULL default '0';
ALTER TABLE `c_diary` ADD COLUMN `comment_count` int(11) NOT NULL default '0';
ALTER TABLE `c_diary` ADD COLUMN `e_datetime` date NOT NULL default '0000-00-00 00:00:00';
ALTER TABLE c_diary ADD INDEX e_datetime(c_member_id,e_datetime);

ALTER TABLE `c_member` ADD COLUMN `is_diary_comment_mail` int(1) NOT NULL default '0';
ALTER TABLE `c_ashiato` ADD COLUMN `is_mobile` varchar(8) NOT NULL default 'pc';
ALTER TABLE `c_diary_comment` ADD `comment_number` INT( 11 ) NOT NULL DEFAULT '0';

-- 
-- テーブルの構造 `c_ranking`
-- 

CREATE TABLE `c_ranking` (
  `c_ranking_id` int(11) NOT NULL auto_increment,
  `ranking_date` date NOT NULL,
  `ranking_flag` int(1) NOT NULL,
  `id` int(11) NOT NULL,
  `ranking_count` int(11) NOT NULL,
  PRIMARY KEY  (`c_ranking_id`),
  KEY `ranking_date` (`ranking_date`,`ranking_count`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


CREATE TABLE `c_diary_tag` (
  `c_diary_tag_id` int(11) NOT NULL auto_increment,
  `c_diary_id` int(11) NOT NULL default '0',
  `c_tags_id` int(11) NOT NULL default '0',
  `entry_member_id` int(11) NOT NULL default '0',
  `r_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY (`c_diary_tag_id`),
  KEY `c_diary_id` (`c_diary_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


-- 
-- テーブルの構造 `c_dengon_comment`
-- 

CREATE TABLE `c_dengon_comment` (
  `c_dengon_comment_id` int(11) NOT NULL auto_increment,
  `c_member_id_to` int(11) NOT NULL default '0',
  `c_member_id_from` int(11) NOT NULL default '0',
  `body` text NOT NULL,
  `r_datetime` datetime NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`c_dengon_comment_id`),
  KEY `c_member_id_to` (`c_member_id_to`,`r_datetime`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ;


