Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 22 lines (17 sloc) 0.7 kB
3665a5f @lygaret initial commits
lygaret authored
1 require 'active_record'
2 require 'yaml'
3
4 task :default => :migrate
5
6 desc "Migrate the database through scripts in db/migrate. Target a specific version through VERSION=x"
7 task :migrate do
062116e @dakrone added environments to the db config file, location for the git checko…
authored
8 dbconfig = YAML::load(File.open('db/env.yml'))
3665a5f @lygaret initial commits
lygaret authored
9 ActiveRecord::Base.colorize_logging = false
062116e @dakrone added environments to the db config file, location for the git checko…
authored
10 ActiveRecord::Base.establish_connection(dbconfig['development'])
3665a5f @lygaret initial commits
lygaret authored
11 ActiveRecord::Base.logger = Logger.new(File.open('db/dev.log', 'a'))
12
13 version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
14 ActiveRecord::Migrator.migrate('db/migrate', version)
15 end
16
062116e @dakrone added environments to the db config file, location for the git checko…
authored
17 desc "Delete the database"
3665a5f @lygaret initial commits
lygaret authored
18 task :dropdb do
062116e @dakrone added environments to the db config file, location for the git checko…
authored
19 dbconfig = YAML::load(File.open('db/env.yml'))
20 File.delete(dbconfig['development']['database'])
3665a5f @lygaret initial commits
lygaret authored
21 end
Something went wrong with that request. Please try again.