Some fixes for MySQL and PostgreSQL files in TestLink 1.9.20 (branch testlink_1_9_20_fixed) #251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
following my previous pull request, here is some more.
I wrote a little bash script (attached and explained below) to help me install, update and compare testlink database schemas from 1.9.19 updated to 1.9.20 versus a stock 19.20 installation (outputting the structure to an SQL file and using
diff).Proposed fixes in this pull request
I made a change in
install/sql/alter_tables/1.9.20/mysql/DB.1.9.20/step1/db_schema_update.sqlso that thediffwould return no difference, although I believe the difference wouldn't break anything.I also made changes to
install/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sqlandinstall/sql/postgres/testlink_create_tables.sqlso the SQL script won't break at execution and thediffwould return no difference either.Explanations on the differences can be found below.
Homemade bash script (bonus)
Here is the bash script that helps me with installing, updating and comparing TestLink databases from the command-line. It is not perfect yet, but if you want, you can include it in the TestLink codebase (or I could do another pull request for that if you prefer).
tl_database.sh.txt
Sample usage
Get sources from github in directory
/tmp/github.comfortestlink_1_9_20_fixed1.9.20_tl-database_script_fix_sql_schemasMySQL
Check the original code
Check the proposed solution
Explanations
1. Inconsistent
unsignedusageSolution
Update lines 25 and 26 from
install/sql/alter_tables/1.9.20/mysql/DB.1.9.20/step1/db_schema_update.sqlto usetinyint(1) unsignedResult
2020-02-03 15:11:55 INFO OK, database structures are the same 2020-02-03 15:11:55 DEBUG Deleting compare directory "/tmp/tmp.Apb0GtItg3" 2020-02-03 15:11:55 INFO Process 23078 exited normallyPostgreSQL
Check the original code
Check the proposed solution
Explanations
1. Unique name for indexes in
install/sql/postgres/testlink_create_tables.sqlSolution
Update line 928 and [941,942] from
install/sql/postgres/testlink_create_tables.sqlto use unique index names2. Unique name for indexes in
install/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sqlUpdate line 45 and [58,59] from
install/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sqlto use unique index names3.
INT unsignedshould beINTSolution
Update lines [937,938] from
install/sql/postgres/testlink_create_tables.sqlto not useunsigned, since they arenot supported by PostgreSQL.
4. Missing table
execution_tcsteps_wipininstall/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sqlSolution
Add the table definition code in
install/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sqlaround line 23