mongoid_migration 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
ActiveRecord::Migration ported to Mongoid to run incremental/reversible migrations to manipulate/populate data in the database.
|
4
4
|
|
5
|
+
== Rails 3.x
|
6
|
+
|
7
|
+
insert this line to Gemfile:
|
8
|
+
|
9
|
+
gem "mongoid_migration", "~> 0.0.3"
|
10
|
+
|
5
11
|
== Rails Generator
|
6
12
|
|
7
13
|
Run the generator to generate timestamped migration files:
|
@@ -22,5 +28,16 @@ Obviously ActiveRecord::ConnectionAdapters::SchemaStatements methods have not be
|
|
22
28
|
* rake db:mongoid:rollback # Rolls migrations back to the previous version (specify steps w/ STEP=n).
|
23
29
|
* rake db:mongoid:version # Retrieves the current schema version number
|
24
30
|
|
31
|
+
== Contributing to MongoidMigration
|
32
|
+
|
33
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
34
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
35
|
+
* Fork the project
|
36
|
+
* Start a feature/bugfix branch
|
37
|
+
* Commit and push until you are happy with your contribution
|
38
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
39
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
40
|
+
|
41
|
+
|
25
42
|
This is the fork of ActiveRecord::Migrations ported to work with mongoid.
|
26
43
|
All thanks should go to the Rails team.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.0.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.1
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: mongoid
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,29 +37,44 @@ dependencies:
|
|
32
37
|
version: 2.0.1
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: bson_ext
|
38
|
-
requirement: &70151338042380 !ruby/object:Gem::Requirement
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
41
|
none: false
|
40
42
|
requirements:
|
41
43
|
- - ! '>='
|
42
44
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70151338042380
|
45
|
+
version: 2.0.1
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
47
|
name: rails
|
49
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
50
49
|
none: false
|
51
50
|
requirements:
|
52
|
-
- - =
|
51
|
+
- - '='
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: 3.1.1
|
55
54
|
type: :development
|
56
55
|
prerelease: false
|
57
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.1
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bson_ext
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
description: ActiveRecord::Migration ported to Mongoid
|
59
79
|
email:
|
60
80
|
- computadude@me.com
|
@@ -68,7 +88,6 @@ files:
|
|
68
88
|
- lib/generators/mongoid_migration/USAGE
|
69
89
|
- lib/mongoid_migration/migration.rb
|
70
90
|
- lib/mongoid_migration/railtie.rb
|
71
|
-
- lib/mongoid_migration/railties/mongoid_migration_tasks.rake
|
72
91
|
- lib/mongoid_migration/version.rb
|
73
92
|
- lib/mongoid_migration.rb
|
74
93
|
- lib/tasks/mongoid_migration_tasks.rake
|
@@ -127,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
146
|
version: '0'
|
128
147
|
segments:
|
129
148
|
- 0
|
130
|
-
hash:
|
149
|
+
hash: 1269953636149721865
|
131
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
151
|
none: false
|
133
152
|
requirements:
|
@@ -136,10 +155,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
155
|
version: '0'
|
137
156
|
segments:
|
138
157
|
- 0
|
139
|
-
hash:
|
158
|
+
hash: 1269953636149721865
|
140
159
|
requirements: []
|
141
160
|
rubyforge_project:
|
142
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.23
|
143
162
|
signing_key:
|
144
163
|
specification_version: 3
|
145
164
|
summary: ActiveRecord::Migration ported to Mongoid
|
@@ -1,68 +0,0 @@
|
|
1
|
-
namespace :db do
|
2
|
-
namespace :mongoid do
|
3
|
-
|
4
|
-
namespace :migration do
|
5
|
-
desc 'Runs the "up" for a given migration VERSION.'
|
6
|
-
task :up => :environment do
|
7
|
-
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
8
|
-
raise "VERSION is required" unless version
|
9
|
-
MongoidMigration::Migrator.run(:up, "mongodb/migrate/", version)
|
10
|
-
end
|
11
|
-
|
12
|
-
desc 'Runs the "down" for a given migration VERSION.'
|
13
|
-
task :down => :environment do
|
14
|
-
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
15
|
-
raise "VERSION is required" unless version
|
16
|
-
MongoidMigration::Migrator.run(:down, "mongodb/migrate/", version)
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "Display status of migrations"
|
20
|
-
task :status => :environment do
|
21
|
-
|
22
|
-
db_list = MongoidMigration::Migration.all.map &:version
|
23
|
-
file_list = []
|
24
|
-
Dir.foreach(File.join(Rails.root, 'mongodb', 'migrate')) do |file|
|
25
|
-
# only files matching "20091231235959_some_name.rb" pattern
|
26
|
-
if match_data = /(\d{14})_(.+)\.rb/.match(file)
|
27
|
-
status = db_list.delete(match_data[1]) ? 'up' : 'down'
|
28
|
-
file_list << [status, match_data[1], match_data[2]]
|
29
|
-
end
|
30
|
-
end
|
31
|
-
# output
|
32
|
-
puts "#{"Status".center(8)} #{"Migration ID".ljust(14)} Migration Name"
|
33
|
-
puts "-" * 50
|
34
|
-
file_list.each do |file|
|
35
|
-
puts "#{file[0].center(8)} #{file[1].ljust(14)} #{file[2].humanize}"
|
36
|
-
end
|
37
|
-
db_list.each do |version|
|
38
|
-
puts "#{'up'.center(8)} #{version.ljust(14)} *** NO FILE ***"
|
39
|
-
end
|
40
|
-
puts
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
desc "Retrieves the current schema version number"
|
45
|
-
task :version => :environment do
|
46
|
-
puts "Current version: #{MongoidMigration::Migrator.current_version}"
|
47
|
-
end
|
48
|
-
|
49
|
-
desc "Migrate the database (options: VERSION=x, VERBOSE=false)."
|
50
|
-
task :migrate => :environment do
|
51
|
-
MongoidMigration::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
52
|
-
MongoidMigration::Migrator.migrate 'mongodb/migrate', ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
53
|
-
end
|
54
|
-
|
55
|
-
desc 'Rolls migrations back to the previous version (specify steps w/ STEP=n).'
|
56
|
-
task :rollback => :environment do
|
57
|
-
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
|
58
|
-
MongoidMigration::Migrator.rollback('mongodb/migrate/', step)
|
59
|
-
end
|
60
|
-
|
61
|
-
desc 'Pushes migrations to the next version (specify steps w/ STEP=n).'
|
62
|
-
task :forward => :environment do
|
63
|
-
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
|
64
|
-
MongoidMigration::Migrator.forward('mongodb/migrate/', step)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|