data_migrate 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
 
@@ -1,3 +1,3 @@
1
1
  module DataMigrate
2
- VERSION = "1.1.1"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
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-06-04 00:00:00.000000000 Z
12
+ date: 2013-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails