From 283b453051f38ce1b9ed3e2017fd62ed850b01b1 Mon Sep 17 00:00:00 2001 From: Jeremy Friesen Date: Wed, 17 Jun 2020 16:34:13 -0400 Subject: [PATCH] Changing column type [Needs Upgrade Notes] I do not believe this change column is likely used by adopters; It has to do with adding permissions to an individual Sipity::Entity. The change is necessary because the foreign key was created as a string, but the associated primary key on the other table was an integer. This is likely a bad copy paste job from ndlib/sipity --- .regen | 2 +- ...9_change_sipity_entity_specific_responsibility.rb.erb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 lib/generators/hyrax/templates/db/migrate/20200617002029_change_sipity_entity_specific_responsibility.rb.erb diff --git a/.regen b/.regen index 6f4247a625..ea7fcc2049 100644 --- a/.regen +++ b/.regen @@ -1 +1 @@ -26 +28a diff --git a/lib/generators/hyrax/templates/db/migrate/20200617002029_change_sipity_entity_specific_responsibility.rb.erb b/lib/generators/hyrax/templates/db/migrate/20200617002029_change_sipity_entity_specific_responsibility.rb.erb new file mode 100644 index 0000000000..3f23fbf016 --- /dev/null +++ b/lib/generators/hyrax/templates/db/migrate/20200617002029_change_sipity_entity_specific_responsibility.rb.erb @@ -0,0 +1,9 @@ +class ChangeSipityEntitySpecificResponsibility < ActiveRecord::Migration<%= migration_version %> + def change + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + change_column :sipity_entity_specific_responsibilities, :entity_id, 'integer USING CAST(entity_id AS integer)' + else + change_column :sipity_entity_specific_responsibilities, :entity_id, :integer + end + end +end