Browse files

Merged rev_1_8 changes 7041-7055. Will tag rev_1_8_merge_7041.

  • Loading branch information...
2 parents 462e11c + ca57b5a commit b04edd00df6f948fd5f884e100894ca6bc9696df @theory theory committed Jan 19, 2006
View
3 inst/upgrade/1.8.9/add_keyword_fks.pl
@@ -6,9 +6,8 @@
use lib catdir $FindBin::Bin, updir, 'lib';
use bric_upgrade qw(:all);
-exit if test_constraint 'category_keyword', 'fk_keyword__category_keyword';
-
for my $thing (qw(story media category)) {
+ next if test_foreign_key "$thing\_keyword", "fk_keyword__$thing\_keyword";
do_sql
qq{ DELETE from $thing\_keyword
WHERE $thing\_id IN (
View
2 inst/upgrade/1.8.9/add_media_contributor_fks.pl
@@ -6,7 +6,7 @@
use lib catdir $FindBin::Bin, updir, 'lib';
use bric_upgrade qw(:all);
-exit if test_constraint 'media__contributor', 'fk_media__media__contributor';
+exit if test_foreign_key 'media__contributor', 'fk_media__media__contributor';
do_sql
q{ DELETE FROM media__contributor
View
21 inst/upgrade/1.8.9/fix_publish_status.pl
@@ -21,6 +21,27 @@
WHERE published_version IS NULL
AND publish_status = '1'
},
+
+ # We don't know if it has been published since the first
+ # publish date, so just go with that.
+ qq{UPDATE $thing
+ SET publish_date = first_publish_date
+ WHERE publish_date IS NULL
+ AND first_publish_date IS NOT NULL
+ },
+
+ # And the reverse.
+ qq{UPDATE $thing
+ SET first_publish_date = publish_date
+ WHERE first_publish_date IS NULL
+ AND publish_date IS NOT NULL
+ },
+
+ # Remove the publish_status when there are no publish dates.
+ qq{UPDATE $thing
+ SET publish_status = '0'
+ WHERE publish_date IS NULL
+ },
;
}
View
3 inst/upgrade/1.8.9/update_publish_status_check.pl
@@ -6,6 +6,9 @@
use lib catdir $FindBin::Bin, updir, 'lib';
use bric_upgrade qw(:all);
+# Skip it for later versions of Bricolage.
+exit unless test_constraint 'story', 'ck_story__publish_status';
+
for my $thing (qw(story media)) {
do_sql
qq{ALTER TABLE $thing DROP CONSTRAINT ck_$thing\__publish_status},

0 comments on commit b04edd0

Please sign in to comment.