Sha256: 26c21457cf2f8fd17754d7f246d4eff3b7e6d68dad03672ef8e5e5f06ba6b234

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

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/find_scripts'
require 'sql_migrations/sql_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

    def migrate
      databases(&:execute_migrations)
    end

    def seed
      databases(&:seed_database)
    end

    def seed_test
      databases(&:seed_with_fixtures)
    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
    end

    private

    def databases
      Config.databases.each do |name, config|
        db = Database.new(name, config)
        yield db
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sql_migrations-2.1.1 lib/sql_migrations.rb
sql_migrations-2.1.0 lib/sql_migrations.rb
sql_migrations-2.1.0.pre3 lib/sql_migrations.rb