-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
db/migrate/20240703090226_create_decidim_templates.decidim_templates.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_templates (originally 20200518093819) | ||
|
||
class CreateDecidimTemplates < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :decidim_templates_templates do |t| | ||
t.integer :decidim_organization_id, null: false, index: { name: "index_decidim_templates_organization" } | ||
t.references :templatable, polymorphic: true, index: { name: "index_decidim_templates_templatable" } | ||
t.jsonb :name, null: false | ||
t.jsonb :description | ||
t.timestamps | ||
end | ||
end | ||
end |
22 changes: 22 additions & 0 deletions
22
...rate/20240703090227_add_field_values_and_target_to_decidim_templates.decidim_templates.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
# This migration comes from decidim_templates (originally 20221006055954) | ||
|
||
class AddFieldValuesAndTargetToDecidimTemplates < ActiveRecord::Migration[6.0] | ||
class Template < ApplicationRecord | ||
self.table_name = :decidim_templates_templates | ||
end | ||
|
||
def change | ||
add_column :decidim_templates_templates, :field_values, :json, default: {} | ||
add_column :decidim_templates_templates, :target, :string | ||
|
||
reversible do |direction| | ||
direction.up do | ||
# rubocop:disable Rails/SkipsModelValidations | ||
Template.where(templatable_type: "Decidim::Forms::Questionnaire").update_all(target: "questionnaire") | ||
Template.where(templatable_type: "Decidim::Organization").update_all(target: "user_block") | ||
# rubocop:enable Rails/SkipsModelValidations | ||
end | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.