Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 6.1 with autogenerated Active Storage migrations #47709

Closed
wants to merge 10 commits into from
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ git_source(:github) do |repo_name|
"https://github.com/#{repo_name}.git"
end

gem 'rails', '6.0.4.1'
gem 'rails', '6.1.6.1'
gem 'rails-controller-testing', '~> 1.0.5'

# Compile Sprockets assets concurrently in `assets:precompile`.
Expand Down Expand Up @@ -282,7 +282,7 @@ gem 'firebase_token_generator'
gem 'sshkit'
gem 'validates_email_format_of'

gem 'composite_primary_keys', '~> 12.0'
gem 'composite_primary_keys', '~> 13.0'

# GitHub API; used by the DotD script to automatically create new
# releases on deploy
Expand Down Expand Up @@ -325,7 +325,7 @@ install_if require_pg do
gem 'pg', require: false
end

gem 'activerecord-import'
gem 'activerecord-import', '~> 1.0.3'
gem 'active_record_union'
gem 'scenic'
gem 'scenic-mysql_adapter'
Expand Down
159 changes: 81 additions & 78 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -179,38 +179,40 @@ GEM
aws-sdk-route53
aws-sdk-s3
thor
actioncable (6.0.4.1)
actionpack (= 6.0.4.1)
actioncable (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.4.1)
actionpack (= 6.0.4.1)
activejob (= 6.0.4.1)
activerecord (= 6.0.4.1)
activestorage (= 6.0.4.1)
activesupport (= 6.0.4.1)
actionmailbox (6.1.6.1)
actionpack (= 6.1.6.1)
activejob (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
mail (>= 2.7.1)
actionmailer (6.0.4.1)
actionpack (= 6.0.4.1)
actionview (= 6.0.4.1)
activejob (= 6.0.4.1)
actionmailer (6.1.6.1)
actionpack (= 6.1.6.1)
actionview (= 6.1.6.1)
activejob (= 6.1.6.1)
activesupport (= 6.1.6.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.4.1)
actionview (= 6.0.4.1)
activesupport (= 6.0.4.1)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.6.1)
actionview (= 6.1.6.1)
activesupport (= 6.1.6.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.4.1)
actionpack (= 6.0.4.1)
activerecord (= 6.0.4.1)
activestorage (= 6.0.4.1)
activesupport (= 6.0.4.1)
actiontext (6.1.6.1)
actionpack (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
nokogiri (>= 1.8.5)
actionview (6.0.4.1)
activesupport (= 6.0.4.1)
actionview (6.1.6.1)
activesupport (= 6.1.6.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
Expand All @@ -223,27 +225,29 @@ GEM
active_record_query_trace (1.5.3)
active_record_union (1.3.0)
activerecord (>= 4.0)
activejob (6.0.4.1)
activesupport (= 6.0.4.1)
activejob (6.1.6.1)
activesupport (= 6.1.6.1)
globalid (>= 0.3.6)
activemodel (6.0.4.1)
activesupport (= 6.0.4.1)
activerecord (6.0.4.1)
activemodel (= 6.0.4.1)
activesupport (= 6.0.4.1)
activerecord-import (0.22.0)
activemodel (6.1.6.1)
activesupport (= 6.1.6.1)
activerecord (6.1.6.1)
activemodel (= 6.1.6.1)
activesupport (= 6.1.6.1)
activerecord-import (1.0.8)
activerecord (>= 3.2)
activestorage (6.0.4.1)
actionpack (= 6.0.4.1)
activejob (= 6.0.4.1)
activerecord (= 6.0.4.1)
marcel (~> 1.0.0)
activesupport (6.0.4.1)
activestorage (6.1.6.1)
actionpack (= 6.1.6.1)
activejob (= 6.1.6.1)
activerecord (= 6.1.6.1)
activesupport (= 6.1.6.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts_as_list (1.0.4)
activerecord (>= 4.2)
addressable (2.8.0)
Expand Down Expand Up @@ -346,8 +350,8 @@ GEM
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.1)
colorize (0.8.1)
composite_primary_keys (12.0.10)
activerecord (~> 6.0.0)
composite_primary_keys (13.0.3)
activerecord (~> 6.1.0)
concurrent-ruby (1.1.9)
connection_pool (2.2.1)
crack (0.4.5)
Expand Down Expand Up @@ -445,7 +449,7 @@ GEM
geocoder (1.6.4)
get_process_mem (0.2.3)
gherkin (5.1.0)
globalid (0.5.2)
globalid (1.0.0)
activesupport (>= 5.0)
google-api-client (0.52.0)
addressable (~> 2.5, >= 2.5.1)
Expand Down Expand Up @@ -675,24 +679,24 @@ GEM
rack-protection (2.1.0)
rack
rack-ssl-enforcer (0.2.9)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rack-test (2.0.2)
rack (>= 1.3)
rack_csrf (2.5.0)
rack (>= 1.1.0)
rails (6.0.4.1)
actioncable (= 6.0.4.1)
actionmailbox (= 6.0.4.1)
actionmailer (= 6.0.4.1)
actionpack (= 6.0.4.1)
actiontext (= 6.0.4.1)
actionview (= 6.0.4.1)
activejob (= 6.0.4.1)
activemodel (= 6.0.4.1)
activerecord (= 6.0.4.1)
activestorage (= 6.0.4.1)
activesupport (= 6.0.4.1)
bundler (>= 1.3.0)
railties (= 6.0.4.1)
rails (6.1.6.1)
actioncable (= 6.1.6.1)
actionmailbox (= 6.1.6.1)
actionmailer (= 6.1.6.1)
actionpack (= 6.1.6.1)
actiontext (= 6.1.6.1)
actionview (= 6.1.6.1)
activejob (= 6.1.6.1)
activemodel (= 6.1.6.1)
activerecord (= 6.1.6.1)
activestorage (= 6.1.6.1)
activesupport (= 6.1.6.1)
bundler (>= 1.15.0)
railties (= 6.1.6.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
Expand All @@ -703,15 +707,15 @@ GEM
nokogiri (>= 1.6)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
railties (6.0.4.1)
actionpack (= 6.0.4.1)
activesupport (= 6.0.4.1)
railties (6.1.6.1)
actionpack (= 6.1.6.1)
activesupport (= 6.1.6.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.0.0)
raindrops (0.19.0)
rake (11.3.0)
rake (12.3.3)
rambling-trie (2.2.1)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
Expand Down Expand Up @@ -796,8 +800,8 @@ GEM
scenic-mysql_adapter (1.0.1)
mysql2
scenic (>= 1.4.0)
scss_lint (0.49.0)
rake (>= 0.9, < 12)
scss_lint (0.55.0)
rake (>= 0.9, < 13)
sass (~> 3.4.20)
selenium-webdriver (3.141.0)
childprocess (~> 0.5)
Expand All @@ -820,9 +824,9 @@ GEM
activesupport (>= 4.2)
spring-commands-testunit (1.0.1)
spring (>= 0.9.1)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
sshkit (1.20.0)
Expand All @@ -843,7 +847,6 @@ GEM
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (1.1.0)
thread_safe (0.3.6)
tilt (2.0.10)
timecop (0.8.1)
trailblazer-option (0.1.1)
Expand All @@ -852,8 +855,8 @@ GEM
faraday (>= 0.9, < 2.0)
jwt (>= 1.5, <= 2.5)
nokogiri (>= 1.6, < 2.0)
tzinfo (1.2.9)
thread_safe (~> 0.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
uber (0.1.0)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
Expand Down Expand Up @@ -901,7 +904,7 @@ GEM
xxhash (0.4.0)
youtube-dl.rb (0.3.1.2016.08.19)
cocaine (>= 0.5.4)
zeitwerk (2.4.2)
zeitwerk (2.6.0)

PLATFORMS
ruby
Expand All @@ -911,7 +914,7 @@ DEPENDENCIES
active_model_serializers (~> 0.10.13)
active_record_query_trace
active_record_union
activerecord-import
activerecord-import (~> 1.0.3)
acts_as_list
addressable
annotate (~> 3.1.1)
Expand Down Expand Up @@ -942,7 +945,7 @@ DEPENDENCIES
chronic (~> 0.10.2)
cld
colorize
composite_primary_keys (~> 12.0)
composite_primary_keys (~> 13.0)
crowdin-api (~> 1.2.1)
cucumber
daemons
Expand Down Expand Up @@ -1027,7 +1030,7 @@ DEPENDENCIES
rack-mini-profiler
rack-ssl-enforcer
rack_csrf
rails (= 6.0.4.1)
rails (= 6.1.6.1)
rails-controller-testing (~> 1.0.5)
rambling-trie (>= 2.1.1)
recaptcha
Expand Down
34 changes: 34 additions & 0 deletions dashboard/config/storage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
test:
service: Disk
root: <%= Rails.root.join("tmp/storage") %>

local:
service: Disk
root: <%= Rails.root.join("storage") %>

# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
# service: S3
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
# region: us-east-1
# bucket: your_own_bucket

# Remember not to checkin your GCS keyfile to a repository
# google:
# service: GCS
# project: your_project
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
# bucket: your_own_bucket

# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
# microsoft:
# service: AzureStorage
# storage_account_name: your_account_name
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
# container: your_container_name

# mirror:
# service: Mirror
# primary: local
# mirrors: [ amazon, google, microsoft ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This migration comes from active_storage (originally 20190112182829)
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string

if configured_service = ActiveStorage::Blob.service.name
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
end

change_column :active_storage_blobs, :service_name, :string, null: false
end
end

def down
remove_column :active_storage_blobs, :service_name
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false

t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
end