####
# Author: Sean Colombo
# Date: 3/28/06
#
# This file will construct the database tables and values for Motive FS.
####

####
# Holds the references to the files and their hash values.
####
DROP TABLE IF EXISTS motive_fs_files;
CREATE TABLE motive_fs_files(
	id INT(11) NOT NULL AUTO_INCREMENT,

	fileName VARCHAR(255), # with extensions
	hash_md5 VARCHAR(32),
	hash_sha1 VARCHAR(40),
	
	numRefs INT(11) DEFAULT 1, # number of references to this file

	PRIMARY KEY(id)
);

####
# A map to hold some of the state of Motive FS.
####
DROP TABLE IF EXISTS motive_fs_map;
CREATE TABLE motive_fs_map(
	keyName VARCHAR(255) NOT NULL,
	value VARCHAR(255),

	PRIMARY KEY(keyName)
);

# These values are needed to track the renaming since any more than 32k files
# in one directory can cause problems in most file-systems.
INSERT INTO motive_fs_map (keyName, value) VALUES ('CURR_ROOT_DIR', '000'); # can append sub-dirs to this as needed.
INSERT INTO motive_fs_map (keyName, value) VALUES ('CURR_SUB_DIR', '000');
INSERT INTO motive_fs_map (keyName, value) VALUES ('NEXT_FILE', '000');
