data_migrate 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -5,7 +5,7 @@ Run data migrations alongside schema migrations.
5
5
 
6
6
  Data migrations are stored in db/data. They act like schema
7
7
  migrations, except they should be reserved for data migrations. For
8
- instance, if you realize you need to titleize all yours titles, this
8
+ instance, if you realize you need to titleize all your titles, this
9
9
  is the place to do it.
10
10
 
11
11
  Why should I use this?
@@ -25,7 +25,7 @@ For instance, lets take an absurd example, to illustrate: You have
25
25
  your infamous [Rails blog](http://media.rubyonrails.org/video/rails-0-5.mov)
26
26
  that has posts with many comments. After some use, you decide you are
27
27
  going to be a trend setter, and want only one comment per post, and
28
- just the text. "Frist!" rules the day. Given that you:
28
+ just the text. "Frist!!1!1" rules the day. Given that you:
29
29
  - write a migration to add a comment column to Post
30
30
  - write a migration to move the contents of the first comments to the Post
31
31
  - drop the column_id column from Post
@@ -71,7 +71,7 @@ Note: If a data and schema migration share the same version number, schema gets
71
71
  Rails 3 and Ruby 1.9
72
72
  --------------------
73
73
 
74
- Data Migrate is Rails 3.0.0 - 3.0.7, and Ruby 1.9 compatible
74
+ Data Migrate is Rails 3 and Ruby 1.9 compatible.
75
75
 
76
76
  Installation
77
77
  ------------
@@ -110,22 +110,22 @@ If you need a data only migration, either run it as such, with the skip-schema-m
110
110
  ### Rake Tasks
111
111
 
112
112
  $> rake -T data
113
- rake data:forward # Pushes the schema to the next version (specify steps w/ STEP=n).
114
- rake data:migrate:down # Runs the "down" for a given migration VERSION.
115
- rake data:migrate:redo # Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).
113
+ rake data:forward # Pushes the schema to the next version (specify steps w/ STEP=n)
114
+ rake data:migrate # Migrate data migrations (options: VERSION=x, VERBOSE=false)
115
+ rake data:migrate:down # Runs the "down" for a given migration VERSION
116
+ rake data:migrate:redo # Rollbacks the database one migration and re migrate up (options: STEP=x, VERSIO...
116
117
  rake data:migrate:status # Display status of data migrations
117
- rake data:migrate:up # Runs the "up" for a given migration VERSION.
118
- rake data:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n).
118
+ rake data:migrate:up # Runs the "up" for a given migration VERSION
119
+ rake data:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n)
119
120
  rake data:version # Retrieves the current schema version number for data migrations
120
- rake db:forward:with_data # Pushes the schema to the next version (specify steps w/ STEP=n).
121
- rake db:migrate:data # Migrate the database through scripts in db/data/migrate.
122
- rake db:migrate:down:with_data # Runs the "down" for a given migration VERSION.
123
- rake db:migrate:redo:with_data # Rollbacks the database one migration and re migrate up (options: STEP=x, VERSION=x).
121
+ rake db:forward:with_data # Pushes the schema to the next version (specify steps w/ STEP=n)
122
+ rake db:migrate:down:with_data # Runs the "down" for a given migration VERSION
123
+ rake db:migrate:redo:with_data # Rollbacks the database one migration and re migrate up (options: STEP=x, VERSIO...
124
124
  rake db:migrate:status:with_data # Display status of data and schema migrations
125
- rake db:migrate:up:with_data # Runs the "up" for a given migration VERSION.
126
- rake db:migrate:with_data # Migrate the database data and schema (options: VERSION=x, VERBOSE=false).
127
- rake db:rollback:with_data # Rolls the schema back to the previous version (specify steps w/ STEP=n).
128
- rake db:version:with_data # Retrieves the current schema version numbers for data and schema migrations `
125
+ rake db:migrate:up:with_data # Runs the "up" for a given migration VERSION
126
+ rake db:migrate:with_data # Migrate the database data and schema (options: VERSION=x, VERBOSE=false)
127
+ rake db:rollback:with_data # Rolls the schema back to the previous version (specify steps w/ STEP=n)
128
+ rake db:version:with_data # Retrieves the current schema version numbers for data and schema migrations
129
129
 
130
130
  Tasks work as they would with the 'vanilla' db version. The 'with_data' addition to the 'db' tasks will run the task in the context of both the data and schema migrations. That is, `rake db:rollback:with_data` will check to see if it was a schema or data migration invoked last, and do that. Tasks invoked in that space also have an additional line of output, indicating if the action is performed on data or schema.
131
131
 
data/data_migrate.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
 
15
15
  s.rubyforge_project = "data_migrate"
16
16
 
17
- s.add_dependency('rails', '>= 3.0.0', '<= 3.0.7')
17
+ s.add_dependency('rails', '>= 3.0.0')
18
18
 
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,3 +1,3 @@
1
1
  module DataMigrate
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/tasks/databases.rake CHANGED
@@ -214,6 +214,7 @@ namespace :db do
214
214
  end
215
215
 
216
216
  namespace :data do
217
+ desc 'Migrate data migrations (options: VERSION=x, VERBOSE=false)'
217
218
  task :migrate => :environment do
218
219
  assure_data_schema_table
219
220
  ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
@@ -352,7 +353,7 @@ def past_migrations sort=nil
352
353
  end
353
354
 
354
355
  def assure_data_schema_table
355
- config = ActiveRecord::Base.configurations[Rails.env || 'development']
356
+ config = ActiveRecord::Base.configurations[Rails.env || 'development'] || ENV["DATABASE_URL"]
356
357
  ActiveRecord::Base.establish_connection(config)
357
358
  sm_table = DataMigrate::DataMigrator.schema_migrations_table_name
358
359
 
metadata CHANGED
@@ -1,41 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: data_migrate
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
4
5
  prerelease:
5
- version: 1.1.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Andrew J Vargo
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-05-05 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-06-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: rails
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
23
21
  version: 3.0.0
24
- - - <=
25
- - !ruby/object:Gem::Version
26
- version: 3.0.7
27
22
  type: :runtime
28
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
29
30
  description: Rake tasks to migrate data alongside schema changes.
30
- email:
31
+ email:
31
32
  - ajvargo@computer.org
32
33
  executables: []
33
-
34
34
  extensions: []
35
-
36
35
  extra_rdoc_files: []
37
-
38
- files:
36
+ files:
39
37
  - .gitignore
40
38
  - Gemfile
41
39
  - LICENSE
@@ -54,30 +52,26 @@ files:
54
52
  - tasks/databases.rake
55
53
  homepage: http://ajvargo.com
56
54
  licenses: []
57
-
58
55
  post_install_message:
59
56
  rdoc_options: []
60
-
61
- require_paths:
57
+ require_paths:
62
58
  - lib
63
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
64
60
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
69
- required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
66
  none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
75
71
  requirements: []
76
-
77
72
  rubyforge_project: data_migrate
78
- rubygems_version: 1.7.2
73
+ rubygems_version: 1.8.23
79
74
  signing_key:
80
75
  specification_version: 3
81
76
  summary: Rake tasks to migrate data alongside schema changes.
82
77
  test_files: []
83
-