Monday, February 02, 2009

Testopia 2.2 is Here... Really... sort of...

Testopia 2.2 is out.

However, there still seem to be some lingering issues with upgrading from earlier versions. Specifically when it attempts to add foreign keys, you may get an error that looks something like this:

Adding foreign key: test_case_activity.case_id -> test_cases.case_id...
DBD::mysql::db do failed: Can't create table './bugs_bugzilla/#sql-965_5bde2.frm' (errno: 150)
[for Statement "ALTER TABLE test_case_activity ADD

CONSTRAINT fk_test_case_activity_case_id_test_cases_case_id FOREIGN KEY (case_id)
REFERENCES test_cases(case_id)

If you see this, it means (due to my earlier stupidity), that you will need to alter the columns referenced to remove the UNSIGNED attribute. This is most easily done using a nice GUI tool such as Mysql Query Browser where you can simply right click on a table, choose edit, and uncheck the box labeled UNSIGNED then click apply and then execute. However, you can also do it from the regular command line client with a command like:

ALTER TABLE `>table<`

Care should be taken to ensure that the column in question really is an INTEGER type (it may be SMALLINT for example) and if it is already an auto_increment column, you will need to add AUTO_INCREMENT at the end. It is best to do a describe table on both tables before hand to ensure the column types and which are key fields. Oh, and you did back up your database first right?

You may have to repeat this process on a handful of columns. I am working on a script that will (hopefully) clean all these up, but in the mean time, this is how to work these out manually if you are so inclined.

This is on Mysql. I am not sure how do it in Postgres or if this is even an issue there.