#
# $Id: mysql_schema,v 1.8 2004/10/23 04:23:42 jamiemccarthy Exp $
#

#
# Table structure for table 'links'
# The url_index really should be an MD5, the way the NewsVac
# plugin does it. - Jamie 2003/07/07
#

DROP TABLE IF EXISTS links;
CREATE TABLE links (
	id CHAR(32) DEFAULT '' NOT NULL,
	url TEXT DEFAULT '' NOT NULL,
	last_seen DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
	is_alive enum('yes','no') DEFAULT 'yes' NOT NULL,
	stats_type VARCHAR(24),
	PRIMARY KEY (id)
) TYPE = InnoDB;

#
# Table structure for table 'links_for_stories'
#

DROP TABLE IF EXISTS links_for_stories;
CREATE TABLE links_for_stories (
	stoid MEDIUMINT UNSIGNED NOT NULL,
	id char(32) DEFAULT '' NOT NULL,
	count INT DEFAULT 0 NOT NULL,
	PRIMARY KEY (id,stoid),
	INDEX stoid (stoid)
) TYPE = InnoDB;

#ALTER TABLE links_for_stories ADD FOREIGN KEY (stoid) REFERENCES stories(stoid);
#ALTER TABLE links_for_stories ADD FOREIGN KEY (sid) REFERENCES stories(sid);
#ALTER TABLE links_for_stories ADD FOREIGN KEY (id) REFERENCES links(id);

