Sha256: 2cef8552cf49146eb3290d205269967f41b4a540125eb8408e6d3cf318a4eabf

Contents?: true

Size: 576 Bytes

Versions: 8

Compression:

Stored size: 576 Bytes

Contents

task :environment do
  ENV["ACTIVE_RECORD_ENV"] ||= "development"
  require_relative './config/environment'
end

namespace :db do
  task :migrate => :environment do
    DB.tables.each do |table|
      DB.execute("DROP TABLE #{table}")
    end

    Dir[File.join(File.dirname(__FILE__), "db/migrations", "*.rb")].each do |f| 
      require f
      migration = Kernel.const_get(f.split("/").last.split(".rb").first.gsub(/\d+/, "").split("_").collect{|w| w.strip.capitalize}.join())
      migration.migrate(:up)
    end
  end
end

task :console => "db:migrate" do
  Pry.start
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
learn-generate-1.0.16 lib/templates/activerecord/Rakefile
learn-generate-1.0.15 lib/templates/activerecord/Rakefile
learn-generate-1.0.14 lib/templates/activerecord/Rakefile
learn-generate-1.0.13 lib/templates/activerecord/Rakefile
learn-generate-1.0.12 lib/templates/activerecord/Rakefile
learn-generate-1.0.11 lib/templates/activerecord/Rakefile
learn-generate-1.0.1 lib/templates/activerecord/Rakefile
learn-generate-1.0.0 lib/templates/activerecord/Rakefile