aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/extensions/gallery_links/db/migrate
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2018-01-07 18:55:03 +0100
committerHarald Eilertsen <haraldei@anduin.net>2018-01-07 18:55:03 +0100
commit00e2586a42931567d2ac18350d41dd882e7fcd92 (patch)
tree93f68b2d3307b8f64187444a769a92cebf135caa /vendor/extensions/gallery_links/db/migrate
parent66eb0bdf9eb080ab3d8becd7cebe7081ca2a06b4 (diff)
downloadhmnoweb-00e2586a42931567d2ac18350d41dd882e7fcd92.tar.gz
hmnoweb-00e2586a42931567d2ac18350d41dd882e7fcd92.tar.bz2
hmnoweb-00e2586a42931567d2ac18350d41dd882e7fcd92.zip
Handle non-matching GalleryLink entries inmigration.
Diffstat (limited to 'vendor/extensions/gallery_links/db/migrate')
-rw-r--r--vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb
index 01bb932..87492b6 100644
--- a/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb
+++ b/vendor/extensions/gallery_links/db/migrate/2_replace_title_with_date_bands_venue.rb
@@ -6,9 +6,15 @@ class ReplaceTitleWithDateBandsVenue < ActiveRecord::Migration
Refinery::GalleryLinks::GalleryLink.all.each do |g|
m = g.title.match /^(.+) (\d{2}\/\d{2}\/\d{2}) @ ([^.]+).$/
- g.date = Date.strptime(m[2], '%d/%m/%y')
- g.bands = m[1]
- g.venue = m[3]
+ if m
+ g.date = Date.strptime(m[2], '%d/%m/%y')
+ g.bands = m[1]
+ g.venue = m[3]
+ else
+ g.date = Date.today
+ g.bands = g.title
+ g.venue = nil
+ end
g.save!
end