-- SVN FILE: $Id: create.sql 621 2008-07-20 03:49:24Z bb_yujiro $
--
-- テーブル定義
--
-- PHP versions 5
--
--      Hitsuji : Social Network Service <http://rakuto.net/rktSNS/>
--      Copyright (c) 2008 Yujiro Takahashi
--
-- Licensed under The MIT License
-- Redistributions of files must retain the above copyright notice.
--
-- @filesource
-- @copyright       Copyright (c) 2008 Yujiro Takahashi
-- @link            http://rakuto.net/
-- @author          Yujiro Takahashi <yujiro@rakuto.net>
-- @package         rktFW
-- @version         $Revision: 621 $
-- @modifiedby      $LastChangedBy: bb_yujiro $
-- @lastmodified    $Date: 2008-07-20 12:49:24 +0900 (譌･, 20 7 2008) $
-- @license         http://opensource.org/licenses/mit-license.php The MIT License
-- --------------------------------------------------------

CREATE TABLE `sns_oid_associations` (
  `id` varchar(40) NOT NULL,
  `server_url` varchar(255) NOT NULL,
  `handle` varchar(255) NOT NULL,
  `secret` blob NOT NULL,
  `issued` int(11) NOT NULL,
  `lifetime` int(11) NOT NULL,
  `assoc_type` varchar(64) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `server_url` (`server_url`),
  KEY `lifetime` (`lifetime`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE `sns_oid_nonces` (
  `server_url` varchar(255) NOT NULL default '',
  `timestamp` int(11) NOT NULL default '0',
  `salt` varchar(40) NOT NULL default '',
  UNIQUE KEY `server_url` (`server_url`,`timestamp`,`salt`),
  KEY `timestamp` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


CREATE TABLE `sns_oid_openid` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  `last_login` datetime NOT NULL default '0000-00-00 00:00:00',
  `regist_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `ref_account` int(11) NOT NULL,
  `hashed_openid` varchar(40) default NULL,
  `host` varchar(128) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `ref_account` (`ref_account`),
  KEY `hashed_openid` (`hashed_openid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;