Skip to content

Commit

Permalink
fix to SAK-11821:added two config file for Oracle and MySQL configura…
Browse files Browse the repository at this point in the history
…tion. User will need to use the file name as the argumenet for running the conversion script

git-svn-id: https://source.sakaiproject.org/svn/assignment/trunk@37172 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
zqian committed Oct 22, 2007
1 parent cdda7db commit 353fdac
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ private void addColumns(Connection connection, SchemaConversionHandler convert,
{
stmt = connection.createStatement();
String sql = driver.getTestNewColumn(names[i]);
log.info("sql=" + sql);
rs = stmt.executeQuery(sql);
if(rs == null || ! rs.first())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static void main(String[] argv)
{
configFile = argv[0];
}
System.out.println("configFile=" + configFile);
try
{
cc.convert(configFile);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# UpgradeSchema Control File (Default)
# Conversion needs the database connection details
dbDriver=com.mysql.jdbc.Driver
#dbURL=jdbc:mysql://127.0.0.1:3306/sakai22?useUnicode=true&characterEncoding=UTF-8
#dbUser=sakai22
#dbPass=sakai22
dbURL=jdbc:mysql://localhost:3306/sakaiQA?useUnicode=true&characterEncoding=UTF-8
dbUser=sakaiDbUser
dbPass=sakaiDbPass
dbURL=PUT_YOUR_URL_HERE
dbUser=PUT_YOUR_USERNAME_HERE
dbPass=PUT_YOUR_PASSWORD_HERE

convert.0=SubmitterIdAssignmentsConversion
convert.0.handler.class=org.sakaiproject.assignment.impl.conversion.impl.SubmitterIdAssignmentsConversionHandler
Expand Down
1 change: 1 addition & 0 deletions assignment/runconversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ CLASSPATH="$CLASSPATH:$HOME/.m2/repository/commons-logging/commons-logging/1.0.4
CLASSPATH="$CLASSPATH:$HOME/.m2/repository/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar"
CLASSPATH="$CLASSPATH:$HOME/.m2/repository/commons-pool/commons-pool/1.3/commons-pool-1.3.jar"
CLASSPATH="$CLASSPATH:$HOME/.m2/repository/mysql/mysql-connector-java/3.1.11/mysql-connector-java-3.1.11.jar"
CLASSPATH="$CLASSPATH:/Users/zqian/apache-tomcat-5.5.23/common/lib/ojdbc14.jar"
CLASSPATH="$CLASSPATH:$HOME/.m2/repository/org/sakaiproject/sakai-util-api/M2/sakai-util-api-M2.jar"
CLASSPATH="$CLASSPATH:$HOME/.m2/repository/org/sakaiproject/sakai-util/M2/sakai-util-M2.jar"
CLASSPATH="$CLASSPATH:$HOME/.m2/repository/org/sakaiproject/sakai-entity-api/M2/sakai-entity-api-M2.jar"
Expand Down
51 changes: 51 additions & 0 deletions assignment/upgradeschema_mysql.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# UpgradeSchema Control File (Default)
# Conversion needs the database connection details
dbDriver=com.mysql.jdbc.Driver
dbURL=PUT_YOUR_URL_HERE
dbUser=PUT_YOUR_USERNAME_HERE
dbPass=PUT_YOUR_PASSWORD_HERE

convert.0=SubmitterIdAssignmentsConversion
convert.0.handler.class=org.sakaiproject.assignment.impl.conversion.impl.SubmitterIdAssignmentsConversionHandler
convert.0.new.columns.names=SUBMITTER_ID,SUBMIT_TIME,SUBMITTED,GRADED,KEEP
convert.0.new.columns.types=VARCHAR(99),VARCHAR(99),VARCHAR(6),VARCHAR(6),VARCHAR(1)
convert.0.new.columns.qualifiers=default null,default null,default null,default null,default 'X'
convert.0.new.columns.add=alter table ASSIGNMENT_SUBMISSION add <name> <type> <qualifier>
convert.0.new.columns.test=show columns from ASSIGNMENT_SUBMISSION like '<name>'
convert.0.create.migrate.table=create table assn_submit_fsregister ( id varchar(1024), status varchar(99) )
convert.0.drop.migrate.table=drop table assn_submit_fsregister
convert.0.check.migrate.table=select count(*) from assn_submit_fsregister where status <> 'done'
convert.0.select.next.batch=select id from assn_submit_fsregister where status = 'pending' limit 100
convert.0.complete.next.batch=update assn_submit_fsregister set status = 'done' where id = ?
convert.0.mark.next.batch=update assn_submit_fsregister set status = 'locked' where id = ?
convert.0.populate.migrate.table=insert into assn_submit_fsregister (id,status) select SUBMISSION_ID, 'pending' from ASSIGNMENT_SUBMISSION
convert.0.select.record=select XML from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.0.select.validate.record=select XML from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.0.update.record=update ASSIGNMENT_SUBMISSION set SUBMITTER_ID = ?, SUBMIT_TIME = ?, SUBMITTED = ?, GRADED = ? where SUBMISSION_ID = ?

convert.1=DuplicateSubmissionAssignmentsConversion
convert.1.handler.class=org.sakaiproject.assignment.impl.conversion.impl.CombineDuplicateSubmissionsConversionHandler
convert.1.create.migrate.table=create table assn_dupes_fsregister (id VARCHAR(99), STATUS VARCHAR(99))
convert.1.drop.migrate.table=drop table assn_dupes_fsregister
convert.1.check.migrate.table=select count(*) from assn_dupes_fsregister where status <> 'done'
convert.1.select.next.batch=select id from assn_dupes_fsregister where status = 'pending' limit 100
convert.1.complete.next.batch=update assn_dupes_fsregister set status = 'done' where id = ?
convert.1.mark.next.batch=update assn_dupes_fsregister set status = 'locked' where id = ?
convert.1.populate.migrate.table=insert into assn_dupes_fsregister (id,status) select SUBMISSION_ID,'pending' from ASSIGNMENT_SUBMISSION group by CONTEXT,SUBMITTER_ID HAVING count(SUBMISSION_ID) > 1
convert.1.select.record=select XML from ASSIGNMENT_SUBMISSION where (CONTEXT, SUBMITTER_ID) = (select CONTEXT, SUBMITTER_ID from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?)
convert.1.select.validate.record=select XML from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.1.update.record=update ASSIGNMENT_SUBMISSION set XML = ?, KEEP = 'T' where SUBMISSION_ID = ?

convert.2=RemoveDuplicateSubmissionAssignmentsConversion
convert.2.handler.class=org.sakaiproject.assignment.impl.conversion.impl.RemoveDuplicateSubmissionsConversionHandler
convert.2.create.migrate.table=create table assn_dupes_fsregister (id VARCHAR(99), STATUS VARCHAR(99))
convert.2.drop.migrate.table=drop table assn_dupes_fsregister
convert.2.check.migrate.table=select count(*) from assn_dupes_fsregister where status <> 'done'
convert.2.select.next.batch=select id from assn_dupes_fsregister where status = 'pending' limit 100
convert.2.complete.next.batch=update assn_dupes_fsregister set status = 'done' where id = ?
convert.2.mark.next.batch=update assn_dupes_fsregister set status = 'locked' where id = ?
convert.2.populate.migrate.table=insert into assn_dupes_fsregister (id,status) select SUBMISSION_ID,'pending' from ASSIGNMENT_SUBMISSION where (CONTEXT,SUBMITTER_ID) = any (select CONTEXT,SUBMITTER_ID from ASSIGNMENT_SUBMISSION group by CONTEXT,SUBMITTER_ID HAVING count(SUBMISSION_ID) > 1) and KEEP <> 'T'
convert.2.select.record=select SUBMISSION_ID from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.2.select.validate.record=select SUBMISSION_ID from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.2.update.record=delete from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?

53 changes: 53 additions & 0 deletions assignment/upgradeschema_oracle.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# UpgradeSchema Control File (Default)
# Conversion needs the database connection details
dbDriver=oracle.jdbc.driver.OracleDriver
dbURL=PUT_YOUR_URL_HERE
dbUser=PUT_YOUR_USERNAME_HERE
dbPass=PUT_YOUR_PASSWORD_HERE

convert.0=SubmitterIdAssignmentsConversion
convert.0.handler.class=org.sakaiproject.assignment.impl.conversion.impl.SubmitterIdAssignmentsConversionHandler
convert.0.new.columns.names=SUBMITTER_ID,SUBMIT_TIME,SUBMITTED,GRADED,KEEP
convert.0.new.columns.types=VARCHAR(99),VARCHAR(99),VARCHAR(6),VARCHAR(6),VARCHAR(1)
convert.0.new.columns.qualifiers=default null,default null,default null,default null,default 'X'
convert.0.new.columns.add=alter table ASSIGNMENT_SUBMISSION add <name> <type> <qualifier>
convert.0.new.columns.test=SELECT column_name FROM user_tab_columns WHERE table_name='ASSIGNMENT_SUBMISSION' and column_name='<name>'
convert.0.create.migrate.table=create table assn_submit_fsregister ( id varchar(1024), status varchar(99) )
convert.0.drop.migrate.table=drop table assn_submit_fsregister
convert.0.check.migrate.table=select count(*) from assn_submit_fsregister where status <> 'done'
convert.0.select.next.batch=select id from assn_submit_fsregister where status = 'pending' and rownum <= 100
convert.0.complete.next.batch=update assn_submit_fsregister set status = 'done' where id = ?
convert.0.mark.next.batch=update assn_submit_fsregister set status = 'locked' where id = ?
convert.0.populate.migrate.table=insert into assn_submit_fsregister (id,status) select SUBMISSION_ID, 'pending' from ASSIGNMENT_SUBMISSION
convert.0.select.record=select XML from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.0.select.validate.record=select XML from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.0.update.record=update ASSIGNMENT_SUBMISSION set SUBMITTER_ID = ?, SUBMIT_TIME = ?, SUBMITTED = ?, GRADED = ? where SUBMISSION_ID = ?

convert.1=DuplicateSubmissionAssignmentsConversion
convert.1.handler.class=org.sakaiproject.assignment.impl.conversion.impl.CombineDuplicateSubmissionsConversionHandler
convert.1.create.migrate.table=create table assn_dupes_fsregister (id VARCHAR(99), STATUS VARCHAR(99))
convert.1.drop.migrate.table=drop table assn_dupes_fsregister
convert.1.check.migrate.table=select count(*) from assn_dupes_fsregister where status <> 'done'
convert.1.select.next.batch=select id from assn_dupes_fsregister where status = 'pending' rownum <= 100
convert.1.complete.next.batch=update assn_dupes_fsregister set status = 'done' where id = ?
convert.1.mark.next.batch=update assn_dupes_fsregister set status = 'locked' where id = ?
#convert.1.populate.migrate.table=insert into assn_dupes_fsregister (id,status) select SUBMISSION_ID,'pending' from ASSIGNMENT_SUBMISSION group by CONTEXT,SUBMITTER_ID HAVING count(SUBMISSION_ID) > 1
convert.1.populate.migrate.table=select submission_id, 'pending' from assignment_submission where submitter_id in (select SUBMITTER_ID from ASSIGNMENT_SUBMISSION group by CONTEXT, SUBMITTER_ID HAVING count(SUBMITTER_ID) > 1)
convert.1.select.record=select XML from ASSIGNMENT_SUBMISSION where (CONTEXT, SUBMITTER_ID) = (select CONTEXT, SUBMITTER_ID from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?)
convert.1.select.validate.record=select XML from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.1.update.record=update ASSIGNMENT_SUBMISSION set XML = ?, KEEP = 'T' where SUBMISSION_ID = ?

convert.2=RemoveDuplicateSubmissionAssignmentsConversion
convert.2.handler.class=org.sakaiproject.assignment.impl.conversion.impl.RemoveDuplicateSubmissionsConversionHandler
convert.2.create.migrate.table=create table assn_dupes_fsregister (id VARCHAR(99), STATUS VARCHAR(99))
convert.2.drop.migrate.table=drop table assn_dupes_fsregister
convert.2.check.migrate.table=select count(*) from assn_dupes_fsregister where status <> 'done'
convert.2.select.next.batch=select id from assn_dupes_fsregister where status =
'pending' and rownum <= 100
convert.2.complete.next.batch=update assn_dupes_fsregister set status = 'done' where id = ?
convert.2.mark.next.batch=update assn_dupes_fsregister set status = 'locked' where id = ?
convert.2.populate.migrate.table=insert into assn_dupes_fsregister (id,status) select SUBMISSION_ID,'pending' from ASSIGNMENT_SUBMISSION where (CONTEXT,SUBMITTER_ID) = any (select CONTEXT,SUBMITTER_ID from ASSIGNMENT_SUBMISSION group by CONTEXT,SUBMITTER_ID HAVING count(SUBMISSION_ID) > 1) and KEEP <> 'T'
convert.2.select.record=select SUBMISSION_ID from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.2.select.validate.record=select SUBMISSION_ID from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?
convert.2.update.record=delete from ASSIGNMENT_SUBMISSION where SUBMISSION_ID = ?

0 comments on commit 353fdac

Please sign in to comment.