Skip to content

Commit

Permalink
Don't allow database creator to overrun any existing database.
Browse files Browse the repository at this point in the history
Add pointer to recompile instructions.
  • Loading branch information
bvds committed May 5, 2010
1 parent 11cb7ea commit 4e8644f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 59 deletions.
2 changes: 1 addition & 1 deletion Documentation/server.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2>Software Updates</h2>
Once we have <a href="http://www.andestutor.org/bugzilla/show_bug.cgi?id=1722">Bug #1722</a> fixed, we will be able update the lisp server without any server
restart.&nbsp;

<p>If the server restart fails (see
<p id="recompile">If the server restart fails (see
<a href="../help-server/init.log"><code>help-server/init.log</code></a>),
you may need to rebuild the lisp object files:
<ul>
Expand Down
100 changes: 42 additions & 58 deletions LogProcessing/databaseCreationScripts/AndesDatabaseCreationSQL.sql
Original file line number Diff line number Diff line change
@@ -1,58 +1,42 @@
/* AndesDatabaseCreationSQL.sql
This is a set of batch SQL commands created by Nicholas Vaidyanathan to simplify
the process of installing the Andes 3 logging DB Schema. To use this script,
run mysql -u root and enter in the password from the shell environment, then once
mysql is started issue the command:
\. AndesDatabaseCreationSQL.sql
This is a lazy, barebones script that will just create the andes database and all associated tables. It will then
attempt to populate them with data based upon CSV files stored in a local directory, in the present case, mine.
In the future, this is a good candidate to be converted into a shell script, with command line arguments for the user directory
*/
-- Creates the database
DROP DATABASE IF EXISTS `andes`;
CREATE DATABASE `andes` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `andes`;
-- Creates the tables NOTE: ORDER OF CREATION MATTERS DUE TO FOREIGN KEY DEPENDENCIES! (ALWAYS MAKE SURE YOU CREATE A TABLE BEFORE YOU CREATE ANOTHER THAT REFERENCES IT)
DROP TABLE IF EXISTS `andes`.`STUDENT_DATASET`;
\. create_STUDENT_DATASET.sql

DROP TABLE IF EXISTS `andes`.`CLASS_INFORMATION`;
\. create_CLASS_INFORMATION.sql

DROP TABLE IF EXISTS `andes`.`PROBLEM_ATTEMPT`;
\. create_PROBLEM_ATTEMPT.sql

DROP TABLE IF EXISTS `andes`.`PROBLEM_ATTEMPT_TRANSACTION`;
\. create_PROBLEM_ATTEMPT_TRANSACTION.sql

DROP TABLE IF EXISTS `andes`.`REVIEWED_PROBLEMS`;
\. create_REVIEWED_PROBLEMS.sql

-- USE THE CREATED DATABASE
USE andes;


insert into STUDENT_DATASET values (1,"Watchung Hills Regional High School Honors Physics 2008-2009","Statics","S*","S2E");
insert into STUDENT_DATASET values (2,"dummy dataset","dummy module","dummy group","dummy problem");

insert into CLASS_INFORMATION values (1,"Physics H (430)","Watchung Hills Regional High School",3,"Introductory physics course for 11th and 12th grades preparing students for the physics SAT II exam.","Brian Brown","2008-2009",1);
insert into CLASS_INFORMATION values (2,"dummy class","dummy school",0,"a dummy class used for lack of knowledge","dumb instructor","dumb year",2);

-- Some mysql installations have file loading disabled.
-- This is the case for CMU/OLI

-- LOAD DATA LOCAL INFILE 'student_dataset.csv' INTO TABLE STUDENT_DATASET FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (datasetID, datasetname, modulename, groupname, problemname);
-- LOAD DATA LOCAL INFILE 'classinformation.csv' INTO TABLE CLASS_INFORMATION FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (classID, name, school, period, description, instructorName, schoolyearInfo, datasetID);

-- Create a database for load testing
DROP DATABASE IF EXISTS `andes_test`;
CREATE DATABASE `andes_test` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `andes_test`;
-- Create the tables. The test tables have a simpler structure than 'andes'.

DROP TABLE IF EXISTS `andes_test`.`PROBLEM_ATTEMPT`;
\. create_test_PROBLEM_ATTEMPT.sql

DROP TABLE IF EXISTS `andes_test`.`PROBLEM_ATTEMPT_TRANSACTION`;
\. create_PROBLEM_ATTEMPT_TRANSACTION.sql
/* AndesDatabaseCreationSQL.sql
This is a set of batch SQL commands created by Nicholas Vaidyanathan to simplify
the process of installing the Andes 3 logging DB Schema. To use this script,
run mysql -u root and enter in the password from the shell environment, then once
mysql is started issue the command:
\. AndesDatabaseCreationSQL.sql
This is a lazy, barebones script that will just create the andes database and all associated tables. It will then
attempt to populate them with data based upon CSV files stored in a local directory, in the present case, mine.
In the future, this is a good candidate to be converted into a shell script, with command line arguments for the user directory
*/
-- Creates the database
CREATE DATABASE `andes` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `andes`;
-- Creates the tables NOTE: ORDER OF CREATION MATTERS DUE TO FOREIGN KEY DEPENDENCIES! (ALWAYS MAKE SURE YOU CREATE A TABLE BEFORE YOU CREATE ANOTHER THAT REFERENCES IT)
\. create_STUDENT_DATASET.sql
\. create_CLASS_INFORMATION.sql
\. create_PROBLEM_ATTEMPT.sql
\. create_PROBLEM_ATTEMPT_TRANSACTION.sql
\. create_REVIEWED_PROBLEMS.sql

-- Insert initial classes into database

insert into STUDENT_DATASET values (1,"Watchung Hills Regional High School Honors Physics 2008-2009","Statics","S*","S2E");
insert into STUDENT_DATASET values (2,"dummy dataset","dummy module","dummy group","dummy problem");

insert into CLASS_INFORMATION values (1,"Physics H (430)","Watchung Hills Regional High School",3,"Introductory physics course for 11th and 12th grades preparing students for the physics SAT II exam.","Brian Brown","2008-2009",1);
insert into CLASS_INFORMATION values (2,"dummy class","dummy school",0,"a dummy class used for lack of knowledge","dumb instructor","dumb year",2);

-- Some mysql installations have file loading disabled.
-- This is the case for CMU/OLI

-- LOAD DATA LOCAL INFILE 'student_dataset.csv' INTO TABLE STUDENT_DATASET FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (datasetID, datasetname, modulename, groupname, problemname);
-- LOAD DATA LOCAL INFILE 'classinformation.csv' INTO TABLE CLASS_INFORMATION FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (classID, name, school, period, description, instructorName, schoolyearInfo, datasetID);

-- Create a database for load testing
CREATE DATABASE `andes_test` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `andes_test`;
-- Create the tables. The test tables have a simpler structure than 'andes'.

\. create_test_PROBLEM_ATTEMPT.sql
\. create_PROBLEM_ATTEMPT_TRANSACTION.sql

0 comments on commit 4e8644f

Please sign in to comment.