#!/bin/sh
#create assignments_and_tests

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application assignments_and_tests`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (assignment_or_test_name char (50) not null,class_name char (15) not null,section integer not null,season char (15) not null,year integer not null,login_name char (20) not null,type char (15),assignment_or_test_date date,max_points integer,doesnt_count_for_average_yn char (1));" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (assignment_or_test_name,class_name,section,season,year,login_name);" | sql.e '^' mysql


#!/bin/sh
#create classes

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application classes`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (class_name char (15) not null,section integer not null,season char (15) not null,year integer not null,login_name char (20) not null);" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (class_name,section,season,year,login_name);" | sql.e '^' mysql


#!/bin/sh
#create enrollments

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application enrollments`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (student_name_last_first_middle char (40) not null,class_name char (15) not null,section integer not null,season char (15) not null,year integer not null,login_name char (20) not null,personal_identification_number integer,dropped_yn char (1));" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (student_name_last_first_middle,class_name,section,season,year,login_name);" | sql.e '^' mysql


#!/bin/sh
#create grades

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application grades`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (student_name_last_first_middle char (40) not null,class_name char (15) not null,section integer not null,season char (15) not null,year integer not null,assignment_or_test_name char (50) not null,login_name char (20) not null,points integer,dropped_yn char (1));" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (student_name_last_first_middle,class_name,section,season,year,assignment_or_test_name,login_name);" | sql.e '^' mysql


#!/bin/sh
#create seasons

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application seasons`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (season char (15) not null);" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (season);" | sql.e '^' mysql


#!/bin/sh
#create terms

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application terms`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (season char (15) not null,year integer not null);" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (season,year);" | sql.e '^' mysql


#!/bin/sh
#create types

if [ "$#" -ne 1 ]
then
	echo "Usage: $0 application" 1>&2
	exit 1
fi
application=$1

if [ "$application" != classgrades ]
then
	exit 0
fi

table_name=`get_table_name $application types`
echo "drop table if exists $table_name;" | sql.e '^' mysql
echo "create table $table_name (type char (15) not null);" | sql.e '^' mysql
echo "create unique index $table_name on $table_name (type);" | sql.e '^' mysql



