From 615be5d887ca566c942aa003f9169009a82412ad Mon Sep 17 00:00:00 2001 From: Gabriel Silva Date: Tue, 12 Jan 2016 19:26:14 +0000 Subject: [PATCH] Adds a migration to fix softwares with no license --- src/noosfero-spb/software_communities/db/migrate/20160112191716_add_license_to_softwares_with_none.rb | 9 +++++++++ 1 file changed, 9 insertions(+), 0 deletions(-) create mode 100644 src/noosfero-spb/software_communities/db/migrate/20160112191716_add_license_to_softwares_with_none.rb diff --git a/src/noosfero-spb/software_communities/db/migrate/20160112191716_add_license_to_softwares_with_none.rb b/src/noosfero-spb/software_communities/db/migrate/20160112191716_add_license_to_softwares_with_none.rb new file mode 100644 index 0000000..da37d38 --- /dev/null +++ b/src/noosfero-spb/software_communities/db/migrate/20160112191716_add_license_to_softwares_with_none.rb @@ -0,0 +1,9 @@ +class AddLicenseToSoftwaresWithNone < ActiveRecord::Migration + def up + execute("UPDATE software_infos SET license_info_id=(SELECT id FROM license_infos WHERE version='Another') WHERE license_info_id IS NULL;") + end + + def down + say "This migration can't be reverted" + end +end -- libgit2 0.21.2