From f4b22283ad837371f71c305a0419417001785554 Mon Sep 17 00:00:00 2001 From: Guillaume MORET <90462045+AyakorK@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:36:46 +0200 Subject: [PATCH] bump: Decidim-Awesome to last commit (#607) * feat: Bump decidim-awesome to last commit * fix: Fix migration that has been changed since first implementation --- Gemfile | 2 +- Gemfile.lock | 6 ++-- ..._private_fields.decidim_decidim_awesome.rb | 30 +++++++++++++++++++ ...ate_fields_date.decidim_decidim_awesome.rb | 21 +++++++++++++ ...ix_reference_for_all_resources.decidim.rb} | 3 +- db/schema.rb | 7 +++-- spec/factories.rb | 2 +- 7 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 db/migrate/20241009105926_add_decidim_awesome_proposal_private_fields.decidim_decidim_awesome.rb create mode 100644 db/migrate/20241009105927_add_decidim_awesome_proposal_private_fields_date.decidim_decidim_awesome.rb rename db/migrate/{20180611126841_fix_reference_for_all_resources.decidim.rb => 20241010092645_fix_reference_for_all_resources.decidim.rb} (90%) diff --git a/Gemfile b/Gemfile index b12773d79c..8108337489 100644 --- a/Gemfile +++ b/Gemfile @@ -24,7 +24,7 @@ gem "decidim-budget_category_voting", git: "https://github.com/alecslupu-pfa/dec gem "decidim-cache_cleaner" gem "decidim-category_enhanced", "~> 0.0.1" gem "decidim-custom_proposal_states", git: "https://github.com/alecslupu-pfa/decidim-module-custom_proposal_states", branch: DECIDIM_BRANCH -gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: "main" +gem "decidim-decidim_awesome", git: "https://github.com/decidim-ice/decidim-module-decidim_awesome", branch: DECIDIM_BRANCH gem "decidim-extended_socio_demographic_authorization_handler", git: "https://github.com/OpenSourcePolitics/decidim-module-extended_socio_demographic_authorization_handler.git", branch: DECIDIM_BRANCH gem "decidim-extra_user_fields", git: "https://github.com/OpenSourcePolitics/decidim-module-extra_user_fields.git", branch: "temp/twilio-compatibility-0.27" diff --git a/Gemfile.lock b/Gemfile.lock index 7224c046d5..2ab93ea6df 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -145,10 +145,10 @@ GIT GIT remote: https://github.com/decidim-ice/decidim-module-decidim_awesome - revision: 058af7db47737e3ca108ac8e08efd5ec55d67a44 - branch: main + revision: 51bc593da8fb72d14c2e5b5df55dbb686be1fbbe + branch: release/0.27-stable specs: - decidim-decidim_awesome (0.10.2) + decidim-decidim_awesome (0.10.3) decidim-admin (>= 0.26.0, < 0.28) decidim-core (>= 0.26.0, < 0.28) deface (>= 1.5) diff --git a/db/migrate/20241009105926_add_decidim_awesome_proposal_private_fields.decidim_decidim_awesome.rb b/db/migrate/20241009105926_add_decidim_awesome_proposal_private_fields.decidim_decidim_awesome.rb new file mode 100644 index 0000000000..8ebac8029f --- /dev/null +++ b/db/migrate/20241009105926_add_decidim_awesome_proposal_private_fields.decidim_decidim_awesome.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# This migration comes from decidim_decidim_awesome (originally 20240531224204) + +class AddDecidimAwesomeProposalPrivateFields < ActiveRecord::Migration[6.0] + class ProposalExtraField < ApplicationRecord + self.table_name = :decidim_awesome_proposal_extra_fields + end + + def change + add_column :decidim_awesome_proposal_extra_fields, :private_body, :string + add_column :decidim_awesome_proposal_extra_fields, :decidim_proposal_type, :string + reversible do |direction| + direction.up do + execute <<~SQL.squish + UPDATE decidim_awesome_proposal_extra_fields + SET decidim_proposal_type = 'Decidim::Proposals::Proposal' + SQL + end + end + + remove_index :decidim_awesome_proposal_extra_fields, name: "decidim_awesome_extra_fields_on_proposal" + add_index :decidim_awesome_proposal_extra_fields, + [:decidim_proposal_id, :decidim_proposal_type], + name: "index_decidim_awesome_proposal_extra_fields_on_decidim_proposal" + + change_column_null :decidim_awesome_proposal_extra_fields, :decidim_proposal_id, false + change_column_null :decidim_awesome_proposal_extra_fields, :decidim_proposal_type, false + ProposalExtraField.reset_column_information + end +end diff --git a/db/migrate/20241009105927_add_decidim_awesome_proposal_private_fields_date.decidim_decidim_awesome.rb b/db/migrate/20241009105927_add_decidim_awesome_proposal_private_fields_date.decidim_decidim_awesome.rb new file mode 100644 index 0000000000..fddad73720 --- /dev/null +++ b/db/migrate/20241009105927_add_decidim_awesome_proposal_private_fields_date.decidim_decidim_awesome.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true +# This migration comes from decidim_decidim_awesome (originally 20240729164227) + +class AddDecidimAwesomeProposalPrivateFieldsDate < ActiveRecord::Migration[6.0] + class ProposalExtraField < ApplicationRecord + self.table_name = :decidim_awesome_proposal_extra_fields + end + + def change + add_column :decidim_awesome_proposal_extra_fields, :private_body_updated_at, :datetime + + reversible do |direction| + direction.up do + execute <<~SQL.squish + UPDATE decidim_awesome_proposal_extra_fields + SET private_body_updated_at = updated_at + SQL + end + end + end +end diff --git a/db/migrate/20180611126841_fix_reference_for_all_resources.decidim.rb b/db/migrate/20241010092645_fix_reference_for_all_resources.decidim.rb similarity index 90% rename from db/migrate/20180611126841_fix_reference_for_all_resources.decidim.rb rename to db/migrate/20241010092645_fix_reference_for_all_resources.decidim.rb index e0dd163ce5..ad0dd85058 100644 --- a/db/migrate/20180611126841_fix_reference_for_all_resources.decidim.rb +++ b/db/migrate/20241010092645_fix_reference_for_all_resources.decidim.rb @@ -1,5 +1,4 @@ # frozen_string_literal: true - # This migration comes from decidim (originally 20180206143340) class FixReferenceForAllResources < ActiveRecord::Migration[5.1] @@ -7,6 +6,8 @@ def up models = ActiveRecord::Base.descendants.select { |c| c.included_modules.include?(Decidim::HasReference) } models.each do |model| + next unless model.table_exists? + model.find_each(&:touch) end end diff --git a/db/schema.rb b/db/schema.rb index 324b3627c7..e2887dfa71 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_09_16_143432) do +ActiveRecord::Schema.define(version: 2024_10_10_092645) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -329,7 +329,10 @@ t.integer "weight_total", default: 0 t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false - t.index ["decidim_proposal_id"], name: "decidim_awesome_extra_fields_on_proposal" + t.string "private_body" + t.string "decidim_proposal_type", null: false + t.datetime "private_body_updated_at" + t.index ["decidim_proposal_id", "decidim_proposal_type"], name: "index_decidim_awesome_proposal_extra_fields_on_decidim_proposal" end create_table "decidim_awesome_vote_weights", force: :cascade do |t| diff --git a/spec/factories.rb b/spec/factories.rb index 271ae13bb0..febc0d8333 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -8,7 +8,7 @@ require "decidim/accountability/test/factories" require "decidim/system/test/factories" require "decidim/participatory_processes/test/factories" -# require "decidim/decidim_awesome/test/factories" +require "decidim/decidim_awesome/test/factories" require "decidim/verifications/test/factories" require "decidim/forms/test/factories" require "decidim/surveys/test/factories"