CREATE TABLE user (
	uid INTEGER AUTO_INCREMENT PRIMARY KEY,
	user VARCHAR(25),
	password VARCHAR(32),
	p_salt VARCHAR(32),
  pass_reset VARCHAR(16),
	first VARCHAR(45),
	last VARCHAR(45), 
	email VARCHAR(45), 
	phone VARCHAR(16),
	other TEXT,
	reminders CHAR(1) DEFAULT 'y',
	private_email CHAR(1) DEFAULT 'n'
);


CREATE TABLE book (
	bid INTEGER AUTO_INCREMENT PRIMARY KEY,
	uid INTEGER,
	date TIMESTAMP(8),
	isbn VARCHAR(13),
	title VARCHAR(75),
	author VARCHAR(45),
	edition VARCHAR(10),
	price FLOAT(4),
	comments TEXT,

	crs_dept VARCHAR(6),
	crs_number VARCHAR(4),
	crs_prof VARCHAR(45)
);

CREATE TABLE log (
	date TIMESTAMP(8),
	uid INTEGER,
	bid INTEGER,
	action VARCHAR(20)
);

CREATE TABLE session (
	sid VARCHAR(16),
	date TIMESTAMP(14),
	uid INTEGER,
	remote_addr VARCHAR(15)
);

CREATE TABLE pending (
	seller_uid INTEGER,
	bid INTEGER,
	buyer_uid INTEGER,
	buyer_name VARCHAR(90),
	buyer_email VARCHAR(45),
	remote_addr VARCHAR(15),
	date TIMESTAMP(8)
);

CREATE TABLE contact (
	cid INTEGER AUTO_INCREMENT PRIMARY KEY,
	date TIMESTAMP(8),
	uid INTEGER,
	name VARCHAR(90),
	email VARCHAR(45),
	message TEXT
);
