From 6129a63764a0ac3c81d7876db5d9a55d1c5c963c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 6 Jul 2017 13:58:43 +0200 Subject: Add task to install the migration needed --- README.md | 1 - lib/active_storage/railtie.rb | 2 +- lib/tasks/activestorage.rake | 12 ++++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/activestorage.rake diff --git a/README.md b/README.md index b768520756..1f0f30098d 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ Add `require "active_storage"` to config/application.rb and create a `config/ini - Proper logging - Convert MirrorService to use threading - Read metadata via Marcel? -- Copy over migration to app via rake task - Add Migrator to copy/move between services - Explore direct uploads to cloud - Extract VerifiedKeyWithExpiration into Rails as a feature of MessageVerifier diff --git a/lib/active_storage/railtie.rb b/lib/active_storage/railtie.rb index bf38d5aff5..15ab8aa096 100644 --- a/lib/active_storage/railtie.rb +++ b/lib/active_storage/railtie.rb @@ -1,7 +1,7 @@ require "rails/railtie" module ActiveStorage - class Railtie < Rails::Railtie # :nodoc: + class Engine < Rails::Engine # :nodoc: config.active_storage = ActiveSupport::OrderedOptions.new config.eager_load_namespaces << ActiveStorage diff --git a/lib/tasks/activestorage.rake b/lib/tasks/activestorage.rake new file mode 100644 index 0000000000..ff44958151 --- /dev/null +++ b/lib/tasks/activestorage.rake @@ -0,0 +1,12 @@ +require "fileutils" + +namespace :activestorage do + desc "Copy over the migration needed to the application" + task :migration do + FileUtils.cp \ + File.expand_path("../../active_storage/migration.rb", __FILE__), + Rails.root.join("db/migrate/#{Time.now.utc.strftime("%Y%m%d%H%M%S")}_active_storage_create_tables.rb") + + puts "Now run rails db:migrate to create the tables for Active Storage" + end +end -- cgit v1.2.3