Skip to content

Commit

Permalink
Merged rev_1_8 changes 7041-7055. Will tag rev_1_8_merge_7041.
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Jan 19, 2006
2 parents 462e11c + ca57b5a commit b04edd0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 1 addition & 2 deletions inst/upgrade/1.8.9/add_keyword_fks.pl
Expand Up @@ -6,9 +6,8 @@
use lib catdir $FindBin::Bin, updir, 'lib'; use lib catdir $FindBin::Bin, updir, 'lib';
use bric_upgrade qw(:all); use bric_upgrade qw(:all);


exit if test_constraint 'category_keyword', 'fk_keyword__category_keyword';

for my $thing (qw(story media category)) { for my $thing (qw(story media category)) {
next if test_foreign_key "$thing\_keyword", "fk_keyword__$thing\_keyword";
do_sql do_sql
qq{ DELETE from $thing\_keyword qq{ DELETE from $thing\_keyword
WHERE $thing\_id IN ( WHERE $thing\_id IN (
Expand Down
2 changes: 1 addition & 1 deletion inst/upgrade/1.8.9/add_media_contributor_fks.pl
Expand Up @@ -6,7 +6,7 @@
use lib catdir $FindBin::Bin, updir, 'lib'; use lib catdir $FindBin::Bin, updir, 'lib';
use bric_upgrade qw(:all); 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 do_sql
q{ DELETE FROM media__contributor q{ DELETE FROM media__contributor
Expand Down
21 changes: 21 additions & 0 deletions inst/upgrade/1.8.9/fix_publish_status.pl
Expand Up @@ -21,6 +21,27 @@
WHERE published_version IS NULL WHERE published_version IS NULL
AND publish_status = '1' 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
},
; ;
} }


Expand Down
3 changes: 3 additions & 0 deletions inst/upgrade/1.8.9/update_publish_status_check.pl
Expand Up @@ -6,6 +6,9 @@
use lib catdir $FindBin::Bin, updir, 'lib'; use lib catdir $FindBin::Bin, updir, 'lib';
use bric_upgrade qw(:all); 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)) { for my $thing (qw(story media)) {
do_sql do_sql
qq{ALTER TABLE $thing DROP CONSTRAINT ck_$thing\__publish_status}, qq{ALTER TABLE $thing DROP CONSTRAINT ck_$thing\__publish_status},
Expand Down

0 comments on commit b04edd0

Please sign in to comment.