From a7c8790f03f6863cf65966a68bf4c2e2aedb5ce3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 20 Apr 2022 11:29:58 +0000 Subject: [PATCH] Bug 30565: Database revision for stockrotationrotas Add unique key if needed. Adjust description column to make it NOT NULL. Test plan: (Optionally:) Drop unique key, make description nullable. Run dbrev. Check if unique key present, and description not-nullable. Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_30565.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_30565.pl diff --git a/installer/data/mysql/atomicupdate/bug_30565.pl b/installer/data/mysql/atomicupdate/bug_30565.pl new file mode 100755 index 00000000000..874a2a2a124 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30565.pl @@ -0,0 +1,19 @@ +use Modern::Perl; + +return { + bug_number => 30565, + description => "Update table stockrotationrotas", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + if( !unique_key_exists('stockrotationrotas', 'stockrotationrotas_title') ) { + $dbh->do( q| +ALTER TABLE stockrotationrotas ADD CONSTRAINT UNIQUE KEY stockrotationrotas_title (title) + |); + } + # Make sure that description is NOT NULL + $dbh->do( q| +ALTER TABLE stockrotationrotas MODIFY COLUMN description text NOT NULL COMMENT 'Description for this rota' + |); + }, +}; -- 2.34.1