[mb-commits] branch, mbs-5770, created. MBS-5770: Ensure that release_labels row have at least a catalog number or a ...

MusicBrainz Git Server <[email protected]> Fri, 25 Jan 2013 11:11:02 +0000
Newsgroups gmane.comp.audio.musicbrainz.cvs
Message-ID <E1TyhBW-0005hv-6O@wiley>
The branch, mbs-5770 has been created
        at  6779ec4e686b71a819560eeebff6424fdf83ce81 (commit)

- Log -----------------------------------------------------------------
commit 6779ec4e686b71a819560eeebff6424fdf83ce81
Author: Oliver Charles <[email protected]>
Date:   Fri Jan 25 11:08:53 2013 +0000

    MBS-5770: Ensure that release_labels row have at least a catalog number or a label

diff --git a/admin/sql/CreateConstraints.sql b/admin/sql/CreateConstraints.sql
index d17c531..9c69445 100644
--- a/admin/sql/CreateConstraints.sql
+++ b/admin/sql/CreateConstraints.sql
@@ -27,4 +27,7 @@ ADD CHECK (
   OR type IS DISTINCT FROM 2
 );
 
+ALTER TABLE release_label
+ADD CHECK (catalog_number IS NOT NULL OR label IS NOT NULL);
+
 COMMIT;
diff --git a/admin/sql/updates/20130125-release_label-not-empty.sql b/admin/sql/updates/20130125-release_label-not-empty.sql
new file mode 100644
index 0000000..5b5deb7
--- /dev/null
+++ b/admin/sql/updates/20130125-release_label-not-empty.sql
@@ -0,0 +1,7 @@
+BEGIN;
+
+DELETE FROM release_label WHERE catalog_number IS NULL AND label IS NULL;
+
+ALTER TABLE release_label ADD CHECK (catalog_number IS NOT NULL OR label IS NOT NULL);
+
+COMMIT;

-----------------------------------------------------------------------


hooks/post-receive
-- 
mb_server