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.sql
so that thediff
would 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.sql
andinstall/sql/postgres/testlink_create_tables.sql
so the SQL script won't break at execution and thediff
would 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.com
fortestlink_1_9_20_fixed
1.9.20_tl-database_script_fix_sql_schemas
MySQL
Check the original code
Check the proposed solution
Explanations
1. Inconsistent
unsigned
usageSolution
Update lines 25 and 26 from
install/sql/alter_tables/1.9.20/mysql/DB.1.9.20/step1/db_schema_update.sql
to usetinyint(1) unsigned
Result
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 normally
PostgreSQL
Check the original code
Check the proposed solution
Explanations
1. Unique name for indexes in
install/sql/postgres/testlink_create_tables.sql
Solution
Update line 928 and [941,942] from
install/sql/postgres/testlink_create_tables.sql
to 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.sql
Update line 45 and [58,59] from
install/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sql
to use unique index names3.
INT unsigned
should beINT
Solution
Update lines [937,938] from
install/sql/postgres/testlink_create_tables.sql
to not useunsigned
, since they arenot supported by PostgreSQL.
4. Missing table
execution_tcsteps_wip
ininstall/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sql
Solution
Add the table definition code in
install/sql/alter_tables/1.9.20/postgres/DB.1.9.20/step1/db_schema_update.sql
around line 23