CREATE DATABASE homework;

USE homework;

# --------------------------------------------------------
#
# Table structure for table 'HWClass'
#

CREATE TABLE HWClass (
   tid int(11) DEFAULT '0' NOT NULL auto_increment,
   teacher text NOT NULL,
   class text NOT NULL,
   PRIMARY KEY (tid)
);


# --------------------------------------------------------
#
# Table structure for table 'HWLog'
#

CREATE TABLE HWLog (
   id int(11) DEFAULT '0' NOT NULL auto_increment,
   tid int(11) DEFAULT '0' NOT NULL,
   duedate date DEFAULT '0000-00-00' NOT NULL,
   assign text NOT NULL,
   PRIMARY KEY (id)
);


# --------------------------------------------------------
#
# Table structure for table 'anecdotal'
#

CREATE TABLE anecdotal (
   id int(11) DEFAULT '0' NOT NULL auto_increment,
   stid int(11) DEFAULT '0' NOT NULL,
   teacher text NOT NULL,
   date timestamp(14),
   comment text NOT NULL,
   PRIMARY KEY (id)
);


# --------------------------------------------------------
#
# Table structure for table 'staff'
#

CREATE TABLE staff (
   id int(11) DEFAULT '0' NOT NULL auto_increment,
   teacher text NOT NULL,
   username text NOT NULL,
   PRIMARY KEY (id)
);


# --------------------------------------------------------
#
# Table structure for table 'studentid'
#

CREATE TABLE studentid (
   stid int(4) DEFAULT '0' NOT NULL,
   firstname text NOT NULL,
   lastname text NOT NULL,
   advisory text NOT NULL,
   PRIMARY KEY (stid)
);

GRANT SELECT, DELETE, INSERT, UPDATE on homework.* 
   to homework@localhost;

INSERT INTO staff (teacher, username) VALUES ('Teacher', 'teacher');

