exodus 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v1.1.4
2
+
3
+ * Added rake task: rake db:reset
4
+
1
5
  ## v1.1.3
2
6
 
3
7
  * Small changes around rerunnable migrations
data/README.md CHANGED
@@ -122,11 +122,16 @@ Exodus - A migration framework for MongoDb
122
122
  rake db:migrate STEP=2
123
123
 
124
124
  ### db:rollback
125
- Rolls back all migrations that haven't run yet. You can set the STEP enviroment variable to rollback only the last x ones.
125
+ Rolls back all migrations that have already run. You can set the STEP enviroment variable to rollback only the last x ones.
126
126
 
127
127
  rake db:rollback
128
128
  rake db:rollback STEP=2
129
129
 
130
+ ### db:reset
131
+ Rolls back all migrations that have already run and then run all migrations.
132
+
133
+ rake db:reset
134
+
130
135
  ### db:migrate:show
131
136
  Print in the console all migrations that rake db:migrate will run. Does NOT run any migration. You can the STEP enviroment to run only the first x ones.
132
137
 
@@ -1,3 +1,3 @@
1
1
  module Exodus
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
data/tasks/exodus.rake CHANGED
@@ -24,6 +24,18 @@ namespace Exodus.configuration.rake_namespace + 'db' do
24
24
  end
25
25
  end
26
26
 
27
+ desc "Reset the database back by rolling back all migrations and then migrating"
28
+ task :reset => :require_env do
29
+ time_it "db:reset" do
30
+ migrations_to_revert = Exodus::Migration.load_all(Exodus.migrations_info.rollback)
31
+ migrations_to_migrate = Exodus::Migration.load_all(Exodus.migrations_info.migrate)
32
+ Exodus::sort_and_run_migrations('down', migrations_to_revert)
33
+
34
+ puts "rolling back is done. Database is now in a virgin state. Migrating in progress..."
35
+ Exodus::sort_and_run_migrations('up', migrations_to_migrate)
36
+ end
37
+ end
38
+
27
39
  desc "Shows informations about the current mongo connection"
28
40
  task :mongo_info => :require_env do
29
41
  p MongoMapper.database
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exodus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-15 00:00:00.000000000 Z
12
+ date: 2014-01-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongo_mapper