standalone_migrations 0.4.8 → 0.4.10

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.markdown CHANGED
@@ -54,7 +54,7 @@ Add database configuration to `db/config.yml` in your projects base directory e.
54
54
 
55
55
  ... and fill in the up and down migrations [Cheatsheet](http://dizzy.co.uk/ruby_on_rails/cheatsheets/rails-migrations).
56
56
 
57
- If you're lazy and want to just execute raw SQL:
57
+ #### If you really want to, you can just execute raw SQL:
58
58
 
59
59
  def self.up
60
60
  execute "insert into foo values (123,'something');"
@@ -64,6 +64,35 @@ If you're lazy and want to just execute raw SQL:
64
64
  execute "delete from foo where field='something';"
65
65
  end
66
66
 
67
+ #### Even better, you can use the _generate_ task to create the initial migration ####
68
+
69
+ The general form is:
70
+
71
+ rake db:generate model="model_name" fields="type:column_name0 type:column_name1 ... type:column_namen"
72
+
73
+ You can have as many fields as you would like.
74
+
75
+ An example to create a Person table with 3 columns (and it will automatically add the t.timestamps line)
76
+
77
+ rake db:generate model="Person" fields="string:first_name string:last_name integer:age"
78
+
79
+ This will create a migration in db/migrations/
80
+
81
+ class CreatePerson < ActiveRecord::Migration
82
+ def self.up
83
+ create_table :Person do |t|
84
+ t.string :first_name
85
+ t.string :last_name
86
+ t.integer :age
87
+ t.timestamps
88
+ end
89
+ end
90
+
91
+ def self.down
92
+ drop_table :Person
93
+ end
94
+ end
95
+
67
96
  ### To apply your newest migration:
68
97
 
69
98
  rake db:migrate
@@ -103,11 +132,13 @@ subdirectory.
103
132
 
104
133
  Contributors
105
134
  ============
106
- This work is based on [Lincoln Stoll's blog post](http://lstoll.net/2008/04/stand-alone-activerecord-migrations/) and [David Welton's post](http://journal.dedasys.com/2007/01/28/using-migrations-outside-of-rails).
107
-
108
135
  - [Todd Huss](http://gabrito.com/)
136
+ - [Two Bit Labs](http://twobitlabs.com/)
109
137
  - [Michael Grosser](http://pragmatig.wordpress.com)
110
138
  - [Eric Lindvall](http://bitmonkey.net)
111
139
  - [Steve Hodgkiss](http://stevehodgkiss.com/)
112
140
  - [Rich Meyers](https://github.com/richmeyers)
113
141
  - [Wes Bailey](http://exposinggotchas.blogspot.com/)
142
+ - [Robert J. Berger](http://blog.ibd.com/)
143
+
144
+ This work is originally based on [Lincoln Stoll's blog post](http://lstoll.net/2008/04/stand-alone-activerecord-migrations/) and [David Welton's post](http://journal.dedasys.com/2007/01/28/using-migrations-outside-of-rails).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.8
1
+ 0.4.10
@@ -156,7 +156,7 @@ class MigratorTasks < ::Rake::TaskLib
156
156
  end
157
157
  end
158
158
 
159
- desc 'Create the database from config/database.yml for the current DATABASE_ENV'
159
+ desc 'Create the database from config/database.yml for the current DB'
160
160
  task :create do
161
161
  ar_init(false)
162
162
  config = ActiveRecord::Base.configurations[self.current_env]
@@ -180,7 +180,7 @@ class MigratorTasks < ::Rake::TaskLib
180
180
  end
181
181
  end
182
182
 
183
- desc 'Drops the database for the current DATABASE_ENV'
183
+ desc 'Drops the database for the current DB'
184
184
  task :drop => :ar_init do
185
185
  config = ActiveRecord::Base.configurations[current_env]
186
186
  drop_database(config)
@@ -289,7 +289,7 @@ class MigratorTasks < ::Rake::TaskLib
289
289
  task :prepare => ["db:#{sub_namespace_with_separator}abort_if_pending_migrations", "db:#{sub_namespace_with_separator}test:load"]
290
290
  end
291
291
 
292
- desc 'generate a model=name field="field1:type field2:type"'
292
+ desc 'generate a model=name field="type:column_name0 type:column_name1 ... type:column_namen"'
293
293
  task :generate do
294
294
  ts = Time.now.strftime '%Y%m%d%H%%M%S'
295
295
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{standalone_migrations}
8
- s.version = "0.4.8"
8
+ s.version = "0.4.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Todd Huss", "Michael Grosser"]
12
- s.date = %q{2011-05-31}
12
+ s.date = %q{2011-06-06}
13
13
  s.email = %q{thuss@gabrito.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 8
9
- version: 0.4.8
8
+ - 10
9
+ version: 0.4.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Todd Huss
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-31 00:00:00 -07:00
18
+ date: 2011-06-06 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency