From 87598c8c80f4cbeef114267d75c46f1c87ca057a Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Mon, 2 Oct 2017 15:46:30 +0900 Subject: Make automatically synchronize test schema work inside engine In Rails engine, migration files are in under `db/migrate` of engine. Therefore, when rake task is executed in engine, `db/migrate` is automatically added to `DatabaseTasks.migrations_paths`. https://github.com/rails/rails/blob/a18cf23a9cbcbeed61e8049442640c7153e0a8fb/activerecord/lib/active_record/railtie.rb#L39..L43 However, if execute the rake task under dummy app, migration files will not be loaded because engine's migration path setting process is not called. Therefore, in order to load migration files correctly, it is necessary to execute rake task under engine. Fixes #30765 --- railties/lib/rails/tasks/engine.rake | 3 +++ 1 file changed, 3 insertions(+) (limited to 'railties/lib/rails/tasks/engine.rake') diff --git a/railties/lib/rails/tasks/engine.rake b/railties/lib/rails/tasks/engine.rake index 3ce49a1641..c967c54aa5 100644 --- a/railties/lib/rails/tasks/engine.rake +++ b/railties/lib/rails/tasks/engine.rake @@ -70,6 +70,9 @@ namespace :db do desc "Retrieves the current schema version number" app_task "version" + + # desc 'Load the test schema' + app_task "test:prepare" end def find_engine_path(path) -- cgit v1.2.3 From 6a728491b66340345a91264b5983ad81944ab97a Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sat, 21 Oct 2017 22:08:33 +0900 Subject: [Railties] require_relative => require This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32 --- railties/lib/rails/tasks/engine.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib/rails/tasks/engine.rake') diff --git a/railties/lib/rails/tasks/engine.rake b/railties/lib/rails/tasks/engine.rake index 3ce49a1641..c24d1ad532 100644 --- a/railties/lib/rails/tasks/engine.rake +++ b/railties/lib/rails/tasks/engine.rake @@ -8,7 +8,7 @@ task "load_app" do task update: [ "update:bin" ] namespace :update do - require_relative "../engine/updater" + require "rails/engine/updater" # desc "Adds new executables to the engine bin/ directory" task :bin do Rails::Engine::Updater.run(:create_bin_files) -- cgit v1.2.3 From 39da171f3c92c6c025a4beaa909ed5180974c094 Mon Sep 17 00:00:00 2001 From: Alberto Almagro Date: Thu, 16 Nov 2017 21:07:55 +0100 Subject: Remove DB naming ambiguity In some places this file referred to the database in three different ways: database, DB and db. The last one caused confusion with the db namespace and the db folder. This commit removes this ambiguity by using the whole word 'database' everywhere --- railties/lib/rails/tasks/engine.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails/tasks/engine.rake') diff --git a/railties/lib/rails/tasks/engine.rake b/railties/lib/rails/tasks/engine.rake index 9db9d78ec4..8d77904210 100644 --- a/railties/lib/rails/tasks/engine.rake +++ b/railties/lib/rails/tasks/engine.rake @@ -53,7 +53,7 @@ namespace :db do desc "Rolls the schema back to the previous version (specify steps w/ STEP=n)." app_task "rollback" - desc "Create a db/schema.rb file that can be portably used against any DB supported by Active Record" + desc "Create a db/schema.rb file that can be portably used against any database supported by Active Record" app_task "schema:dump" desc "Load a schema.rb file into the database" @@ -62,7 +62,7 @@ namespace :db do desc "Load the seed data from db/seeds.rb" app_task "seed" - desc "Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)" + desc "Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)" app_task "setup" desc "Dump the database structure to an SQL file" -- cgit v1.2.3