Fixing database patch 2.3 for CentralNotice

The original patch (https://gerrit.wikimedia.org/r/#/c/52913/) was
badly broken and reverted by (https://gerrit.wikimedia.org/r/#/c/55587/)

This patch fixes the issues found by Hashar.

Change-Id: I2576b0f3230591d84d228c44fee9b4ea0997d566
Merge "Fixing database patch 2.3 for CentralNotice"