From df5f33768ab8bc63a3b146ff4b295b2d6542daec Mon Sep 17 00:00:00 2001 From: leio10 Date: Wed, 30 Jun 2021 08:57:00 +0000 Subject: [PATCH] Update decidim to active_storage_migration branch --- Gemfile | 2 +- Gemfile.lock | 4 +-- ...15_create_active_storage_tables.decidim.rb | 30 ++++++++++++++++ ...umn_in_oauth_applications_table.decidim.rb | 8 +++++ ...cidim_content_block_attachments.decidim.rb | 11 ++++++ ...s_table.decidim_participatory_processes.rb | 8 +++++ db/schema.rb | 34 +++++++++++++++++-- 7 files changed, 91 insertions(+), 6 deletions(-) create mode 100644 db/migrate/20210630085615_create_active_storage_tables.decidim.rb create mode 100644 db/migrate/20210630085616_allow_null_organization_logo_column_in_oauth_applications_table.decidim.rb create mode 100644 db/migrate/20210630085617_create_decidim_content_block_attachments.decidim.rb create mode 100644 db/migrate/20210630085618_allow_null_file_column_in_decidim_attachments_table.decidim_participatory_processes.rb diff --git a/Gemfile b/Gemfile index b9da4d96..71f5ab24 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source "https://rubygems.org" ruby RUBY_VERSION -DECIDIM_VERSION = { git: "https://github.com/decidim/decidim", branch: "develop" } +DECIDIM_VERSION = { git: "https://github.com/decidim/decidim", branch: "active_storage_migration" } gem "decidim", DECIDIM_VERSION #gem "decidim-conferences", DECIDIM_VERSION diff --git a/Gemfile.lock b/Gemfile.lock index 0f4cad0e..7f51759b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ GIT remote: https://github.com/decidim/decidim - revision: 39de071f4f6c16fad8115101882b4c568dfe86f0 - branch: develop + revision: c1f8db7ed0b6638a6eb59568925ec7a19d61e2a9 + branch: active_storage_migration specs: decidim (0.25.0.dev) decidim-accountability (= 0.25.0.dev) diff --git a/db/migrate/20210630085615_create_active_storage_tables.decidim.rb b/db/migrate/20210630085615_create_active_storage_tables.decidim.rb new file mode 100644 index 00000000..0afc5f4c --- /dev/null +++ b/db/migrate/20210630085615_create_active_storage_tables.decidim.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true +# This migration comes from decidim (originally 20210309190009) + +# This migration comes from active_storage (originally 20170806125915) +class CreateActiveStorageTables < ActiveRecord::Migration[5.2] + def change + create_table :active_storage_blobs do |t| + t.string :key, null: false + t.string :filename, null: false + t.string :content_type + t.text :metadata + t.bigint :byte_size, null: false + t.string :checksum, null: false + t.datetime :created_at, null: false + + t.index [:key], unique: true + end + + create_table :active_storage_attachments do |t| + t.string :name, null: false + t.references :record, null: false, polymorphic: true, index: false + t.references :blob, null: false + + t.datetime :created_at, null: false + + t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true + t.foreign_key :active_storage_blobs, column: :blob_id + end + end +end diff --git a/db/migrate/20210630085616_allow_null_organization_logo_column_in_oauth_applications_table.decidim.rb b/db/migrate/20210630085616_allow_null_organization_logo_column_in_oauth_applications_table.decidim.rb new file mode 100644 index 00000000..cd239430 --- /dev/null +++ b/db/migrate/20210630085616_allow_null_organization_logo_column_in_oauth_applications_table.decidim.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This migration comes from decidim (originally 20210407190753) + +class AllowNullOrganizationLogoColumnInOAuthApplicationsTable < ActiveRecord::Migration[6.0] + def change + change_column_null :oauth_applications, :organization_logo, true + end +end diff --git a/db/migrate/20210630085617_create_decidim_content_block_attachments.decidim.rb b/db/migrate/20210630085617_create_decidim_content_block_attachments.decidim.rb new file mode 100644 index 00000000..cbcad613 --- /dev/null +++ b/db/migrate/20210630085617_create_decidim_content_block_attachments.decidim.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true +# This migration comes from decidim (originally 20210419165805) + +class CreateDecidimContentBlockAttachments < ActiveRecord::Migration[6.0] + def change + create_table :decidim_content_block_attachments do |t| + t.string :name + t.references :decidim_content_block, null: false, index: { name: "decidim_content_block_attachments_on_content_block" } + end + end +end diff --git a/db/migrate/20210630085618_allow_null_file_column_in_decidim_attachments_table.decidim_participatory_processes.rb b/db/migrate/20210630085618_allow_null_file_column_in_decidim_attachments_table.decidim_participatory_processes.rb new file mode 100644 index 00000000..ca6a8fb3 --- /dev/null +++ b/db/migrate/20210630085618_allow_null_file_column_in_decidim_attachments_table.decidim_participatory_processes.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true +# This migration comes from decidim_participatory_processes (originally 20210415163339) + +class AllowNullFileColumnInDecidimAttachmentsTable < ActiveRecord::Migration[6.0] + def change + change_column_null :decidim_attachments, :file, true + end +end diff --git a/db/schema.rb b/db/schema.rb index 20867f8e..6fb96e52 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,13 +10,34 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_06_28_083105) do +ActiveRecord::Schema.define(version: 2021_06_30_085618) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" enable_extension "pg_trgm" enable_extension "plpgsql" + create_table "active_storage_attachments", force: :cascade do |t| + t.string "name", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs", force: :cascade do |t| + t.string "key", null: false + t.string "filename", null: false + t.string "content_type" + t.text "metadata" + t.bigint "byte_size", null: false + t.string "checksum", null: false + t.datetime "created_at", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + create_table "decidim_accountability_results", id: :serial, force: :cascade do |t| t.jsonb "title" t.jsonb "description" @@ -237,7 +258,7 @@ create_table "decidim_attachments", id: :serial, force: :cascade do |t| t.jsonb "title", null: false t.jsonb "description" - t.string "file", null: false + t.string "file" t.string "content_type", null: false t.string "file_size", null: false t.integer "attached_to_id", null: false @@ -648,6 +669,12 @@ t.index ["decidim_user_group_id"], name: "index_decidim_consultations_votes_on_decidim_user_group_id" end + create_table "decidim_content_block_attachments", force: :cascade do |t| + t.string "name" + t.bigint "decidim_content_block_id", null: false + t.index ["decidim_content_block_id"], name: "decidim_content_block_attachments_on_content_block" + end + create_table "decidim_content_blocks", force: :cascade do |t| t.integer "decidim_organization_id", null: false t.string "manifest_name", null: false @@ -2084,7 +2111,7 @@ t.string "name", null: false t.string "organization_name", null: false t.string "organization_url", null: false - t.string "organization_logo", null: false + t.string "organization_logo" t.string "uid", null: false t.string "secret", null: false t.text "redirect_uri", null: false @@ -2110,6 +2137,7 @@ t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" end + add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" add_foreign_key "decidim_area_types", "decidim_organizations" add_foreign_key "decidim_areas", "decidim_area_types", column: "area_type_id" add_foreign_key "decidim_areas", "decidim_organizations"