Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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_migrations_service" }

gem "decidim", DECIDIM_VERSION
#gem "decidim-conferences", DECIDIM_VERSION
Expand All @@ -13,8 +13,6 @@ gem "decidim-elections", DECIDIM_VERSION
#gem "decidim-initiatives", DECIDIM_VERSION
#gem "decidim-templates", DECIDIM_VERSION

gem "webpacker", "6.0.0.beta.7"

gem "wicked_pdf"
gem "wkhtmltopdf-binary"

Expand All @@ -36,6 +34,7 @@ group :development do
end

group :production do
gem "aws-sdk-s3", require: false
gem "fog-aws"
gem "lograge"
gem "sendgrid-ruby"
Expand Down
33 changes: 25 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT
remote: https://github.com/decidim/decidim
revision: ab2b342a0643fd7b3a5cfe15d999295f8b46a091
branch: develop
revision: c0c237dd0c41bb818fe3cd1f5314cced8f1a493e
branch: active_storage_migrations_service
specs:
decidim (0.25.0.dev)
decidim-accountability (= 0.25.0.dev)
Expand Down Expand Up @@ -102,7 +102,7 @@ GIT
social-share-button (~> 1.2, >= 1.2.1)
truncato (~> 0.7)
valid_email2 (~> 2.1)
webpacker (~> 6.0.0.beta.7)
webpacker (~> 6.0.0.beta.7, < 6.0.0.c)
wisper (~> 2.0)
decidim-debates (0.25.0.dev)
decidim-comments (= 0.25.0.dev)
Expand Down Expand Up @@ -250,6 +250,22 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
anchored (1.1.0)
ast (2.4.2)
aws-eventstream (1.1.1)
aws-partitions (1.472.0)
aws-sdk-core (3.115.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.44.0)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.96.1)
aws-sdk-core (~> 3, >= 3.112.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.2.3)
aws-eventstream (~> 1, >= 1.0.2)
axe-core-api (4.2.1)
capybara
dumb_delegator
Expand Down Expand Up @@ -419,7 +435,7 @@ GEM
fog-json (1.2.0)
fog-core
multi_json (~> 1.10)
fog-local (0.6.0)
fog-local (0.7.0)
fog-core (>= 1.27, < 3.0)
fog-xml (0.1.3)
fog-core
Expand Down Expand Up @@ -471,6 +487,7 @@ GEM
invisible_captcha (0.13.0)
rails (>= 3.2.0)
ipaddress (0.8.3)
jmespath (1.4.0)
json (2.5.1)
jwt (2.2.3)
kaminari (1.2.1)
Expand Down Expand Up @@ -575,7 +592,7 @@ GEM
activerecord (>= 4.2)
request_store (~> 1.1)
parallel (1.20.1)
parser (3.0.1.1)
parser (3.0.2.0)
ast (~> 2.4.1)
pg (1.1.4)
pg_search (2.3.5)
Expand Down Expand Up @@ -703,7 +720,7 @@ GEM
rubocop-ast (>= 0.5.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.7.0)
rubocop-ast (1.8.0)
parser (>= 3.0.1.1)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
Expand All @@ -720,7 +737,7 @@ GEM
rubyzip (>= 1.3.0)
ruby_dep (1.5.0)
ruby_http_client (3.5.2)
rubyzip (2.3.1)
rubyzip (2.3.2)
searchlight (4.1.0)
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
Expand Down Expand Up @@ -834,6 +851,7 @@ PLATFORMS
ruby

DEPENDENCIES
aws-sdk-s3
byebug
decidim!
decidim-dev!
Expand All @@ -850,7 +868,6 @@ DEPENDENCIES
spring
spring-watcher-listen (~> 2.0.0)
web-console
webpacker (= 6.0.0.beta.7)
wicked_pdf
wkhtmltopdf-binary

Expand Down
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker

# Store files locally.
config.active_storage.service = :local
end
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,7 @@
referer: event.payload[:referer],
}
end

# Store files on Amazon S3.
config.active_storage.service = :amazon
end
3 changes: 3 additions & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,7 @@

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# Store files locally.
config.active_storage.service = :test
end
9 changes: 9 additions & 0 deletions config/initializers/active_storage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

if ENV["HEROKU_APP_NAME"].present?
ActiveSupport.on_load(:active_storage_blob) do
def key
self[:key] ||= "#{Decidim.base_uploads_path}#{self.class.generate_unique_secure_token}"
end
end
end
1 change: 0 additions & 1 deletion config/initializers/decidim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,3 @@

Rails.application.config.i18n.available_locales = Decidim.available_locales
Rails.application.config.i18n.default_locale = Decidim.default_locale

14 changes: 14 additions & 0 deletions config/storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
local:
service: Disk
root: <%= Rails.root.join("storage") %>

test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>

amazon:
service: S3
access_key_id: <%= ENV["AWS_ACCESS_KEY_ID"] %>
secret_access_key: <%= ENV["AWS_SECRET_ACCESS_KEY"] %>
region: <%= ENV["AWS_REGION"] %>
bucket: <%= ENV["AWS_BUCKET_NAME"] %>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class MoveOrganizationFieldsToHeroContentBlock < ActiveRecord::Migration[5.2]
class Organization < ApplicationRecord
self.table_name = :decidim_organizations

mount_uploader :homepage_image, ::Decidim::HomepageImageUploader
mount_uploader :homepage_image, CarrierWave::Uploader::Base
end

def change
Expand Down
30 changes: 30 additions & 0 deletions db/migrate/20210705050501_create_active_storage_tables.decidim.rb
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
34 changes: 31 additions & 3 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,34 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2021_07_05_050450) do
ActiveRecord::Schema.define(version: 2021_07_05_050504) 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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
Loading