« auto/share/dist/Zonemaster-Backend/patch/patch_mysql_db_zonemaster_backend_ver_5.0.2.pl
↑ Summary
auto/share/dist/Zonemaster-Backend/patch/patch_postgresql_db_zonemaster_backend_ver_5.0.0.pl »
| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | use DBI qw(:utils); | ||
| 5 | |||
| 6 | use Zonemaster::Backend::Config; | ||
| 7 | use Zonemaster::Backend::DB::MySQL; | ||
| 8 | |||
| 9 | my $config = Zonemaster::Backend::Config->load_config(); | ||
| 10 | if ( $config->DB_engine ne 'MySQL' ) { | ||
| 11 | die "The configuration file does not contain the MySQL backend"; | ||
| 12 | } | ||
| 13 | my $dbh = Zonemaster::Backend::DB::MySQL->from_config( $config )->dbh; | ||
| 14 | |||
| 15 | sub patch_db { | ||
| 16 | |||
| 17 | #################################################################### | ||
| 18 | # TEST RESULTS | ||
| 19 | #################################################################### | ||
| 20 | $dbh->do( 'ALTER TABLE test_results ADD COLUMN hash_id VARCHAR(16) DEFAULT substring(md5(random()::text || clock_timestamp()::text) from 1 for 16) NOT NULL' ); | ||
| 21 | } | ||
| 22 | |||
| 23 | patch_db(); |