Class: Physique::FluentMigratorTasksBuilder

Inherits:
TasksBuilder show all
Defined in:
lib/physique/task_builders/fluent_migrator.rb

Instance Attribute Summary

Attributes inherited from TasksBuilder

#solution

Instance Method Summary collapse

Methods inherited from TasksBuilder

#build_tasks_for, build_tasks_for, #ensure_output_location, inherited, #namespace, #to_string_or_symbol

Methods included from ToolLocator

#locate_tool, #lookup_tool, #register_tool, #which

Instance Method Details

#build_tasksObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/physique/task_builders/fluent_migrator.rb', line 50

def build_tasks
  dbs = solution.fluent_migrator_dbs
  return if dbs.blank?

  dbs.each do |db|
    expand_project_config db
    task_namespace = db_task_name(db)

    namespace :db do
      namespace task_namespace do
        # First look at the scripts_dir and add a task for every sql file that you find
        defaults = default_tasks(db.name)
        add_script_tasks db, defaults

        # Then add the default minimum required tasks in case the scripts_dir didn't contain them
        add_default_db_tasks db, defaults

        # Add the migrate and rollback tasks
        add_migrator_tasks db

        # Add the tasks to create the db from scratch
        add_create_tasks

        # Add a task to create a new migration in the db project
        add_new_migration_task db
      end
    end

    # Rebuild the databases when running tests
    task :test => "db:#{task_namespace}:rebuild"
  end

  alias_default_tasks
end