Koha/misc
David Cook 5d3bfc5d5b
Bug 34064: Add an audit script to compare database with kohastructure.sql
This script can take a connected database handle and compare that database
schema against kohastructure.sql to see what changes the database would
need in order to match kohastructure.sql

NOTE: It uses SQL::Translation::Diff, which is installed with DBIx::Class.

WARNING: The diff doesn't seem to compare comments, so that difference
won't appear in the output. If we wanted, we could easily enhance the
audit_database.pl script to also compare comments.

WARNING: The output is a proposed series of SQL commands. While they
are useful to review, they won't always duplicate the changes done
by updatedatabase.pl, so it's important to carefully analyze the output.
The key purpose of this audit script is to just highlight the differences
between the two.

Test plan:
0. Apply patch
1. vi ./installer/data/mysql/kohastructure.sql
2. Comment out some columns, change NULL status, or whatever you like
3. perl misc/maintenance/audit_database.pl \
    --filename /kohadevbox/koha/installer/data/mysql/kohastructure.sql
4. Note that the output includes SQL commands to change the database
to match the new kohastructure.sql

5a. Try using koha-foreach and note that the database name appears above
the database comparison
5b. koha-foreach "perl misc/maintenance/audit_database.pl \
    --filename /kohadevbox/koha/installer/data/mysql/kohastructure.sql"

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-10-10 10:54:03 -03:00
..
admin
bin Bug 23241: Remove unused koha-index-daemon-ctl.sh 2023-10-10 09:22:37 -03:00
cronjobs Bug 28688: (follow-up) Remove redundant options 2023-10-10 09:22:32 -03:00
devel
interface_customization
maintenance Bug 34064: Add an audit script to compare database with kohastructure.sql 2023-10-10 10:54:03 -03:00
migration_tools
release_notes
search_tools
translator
workers Bug 34470: Initialize random seed after spawning a child worker process 2023-08-15 11:25:48 +03:00
add_date_fields_to_marc_records.pl
add_statistics_borrowers_categorycode.pl
batchCompareMARCvsFrameworks.pl
batchdeletebiblios.pl
batchDeleteUnusedSubfields.pl
batchImportMARCWithBiblionumbers.pl
batchRebuildBiblioTables.pl
batchRebuildItemsTables.pl
batchRepairMissingBiblionumbers.pl
check_sysprefs.pl
commit_file.pl
export_borrowers.pl
export_records.pl
exportauth.pl
import_patrons.pl Bug 34743: Fix POD description 2023-09-15 11:57:15 -03:00
koha-install-log
link_bibs_to_authorities.pl
load_yaml.pl
mod_zebraqueue.pl
perlmodule_ls.pl
perlmodule_rm.pl
process_ill_updates.pl
recreateIssueStatistics.pl
sax_parser_print.pl
sax_parser_test.pl
sip_cli_emulator.pl Bug 34764: Set fee_acknowledged to expect a string 2023-09-15 11:57:10 -03:00
stage_file.pl
z3950_responder.pl