lib/sql_migrations.rb in sql_migrations-2.2.1 vs lib/sql_migrations.rb in sql_migrations-2.4.0

- old
+ new

@@ -1,57 +1,41 @@ -require 'sequel' -require 'yaml' -require 'find' -require 'benchmark' -require 'time' -require 'erb' - require 'sql_migrations/version' require 'sql_migrations/database' require 'sql_migrations/config' -require 'sql_migrations/script_file' -require 'sql_migrations/sql_script' +require 'sql_migrations/file' +require 'sql_migrations/script' require 'sql_migrations/migration' require 'sql_migrations/seed' -require 'sql_migrations/fixture' # SqlMigrations # module SqlMigrations - class << self - def load_tasks - load 'sql_migrations/tasks/migrate.rake' - load 'sql_migrations/tasks/seed.rake' - load 'sql_migrations/tasks/seed_test.rake' - load 'sql_migrations/tasks/list.rake' - end + extend self - def migrate - databases(&:execute_migrations) - end + def migrate + databases(&:migrate) + end - def seed - databases(&:seed_database) - end + def seed + databases(&:seed) + end - def seed_test - databases(&:seed_with_fixtures) + def scripts + Config.databases.each do |name, _config| + Migration.find(name).each { |migration| puts migration } + Seed.find(name).each { |seed| puts seed } end + end - def list_files - Config.databases.each do |name, _config| - Migration.find(name).each { |migration| puts migration } - Seed.find(name).each { |seed| puts seed } - Fixture.find(name).each { |fixture| puts fixture } - end + def databases + Config.databases.each do |name, config| + db = Database.new(name, config) + yield db if block_given? end + end - private - - def databases - Config.databases.each do |name, config| - db = Database.new(name, config) - yield db - end - end + def load_tasks! + load 'sql_migrations/tasks/migrate.rake' + load 'sql_migrations/tasks/seed.rake' + load 'sql_migrations/tasks/scripts.rake' end end