standalone_migrations 1.0.8 → 1.0.9
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 +1 -34
- data/VERSION +1 -1
- data/lib/tasks/standalone_migrations.rb +2 -2
- data/standalone_migrations.gemspec +3 -3
- metadata +7 -7
data/README.markdown
CHANGED
@@ -50,11 +50,9 @@ Add database configuration to `db/config.yml` in your projects base directory e.
|
|
50
50
|
|
51
51
|
### To create a new database migration:
|
52
52
|
|
53
|
-
rake db:new_migration name=
|
53
|
+
rake db:new_migration name=foo_bar_migration
|
54
54
|
edit db/migrate/20081220234130_foo_bar_migration.rb
|
55
55
|
|
56
|
-
... and fill in the up and down migrations [Cheatsheet](http://dizzy.co.uk/ruby_on_rails/cheatsheets/rails-migrations).
|
57
|
-
|
58
56
|
#### If you really want to, you can just execute raw SQL:
|
59
57
|
|
60
58
|
```ruby
|
@@ -67,37 +65,6 @@ def self.down
|
|
67
65
|
end
|
68
66
|
```
|
69
67
|
|
70
|
-
#### Even better, you can use the _generate_ task to create the initial migration ####
|
71
|
-
|
72
|
-
The general form is:
|
73
|
-
|
74
|
-
rake db:generate model="model_name" fields="type:column_name0 type:column_name1 ... type:column_namen"
|
75
|
-
|
76
|
-
You can have as many fields as you would like.
|
77
|
-
|
78
|
-
An example to create a Person table with 3 columns (and it will automatically add the t.timestamps line)
|
79
|
-
|
80
|
-
rake db:generate model="Person" fields="string:first_name string:last_name integer:age"
|
81
|
-
|
82
|
-
This will create a migration in db/migrate/
|
83
|
-
|
84
|
-
```ruby
|
85
|
-
class CreatePerson < ActiveRecord::Migration
|
86
|
-
def self.up
|
87
|
-
create_table :Person do |t|
|
88
|
-
t.string :first_name
|
89
|
-
t.string :last_name
|
90
|
-
t.integer :age
|
91
|
-
t.timestamps
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.down
|
96
|
-
drop_table :Person
|
97
|
-
end
|
98
|
-
end
|
99
|
-
```
|
100
|
-
|
101
68
|
### To apply your newest migration:
|
102
69
|
|
103
70
|
rake db:migrate
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.9
|
@@ -14,7 +14,7 @@ end
|
|
14
14
|
|
15
15
|
module Rails
|
16
16
|
def self.env
|
17
|
-
s = (ENV['RAILS_ENV'] || ENV['DB'] || 'development').dup # env is frozen -> dup
|
17
|
+
s = (ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['DB'] || 'development').dup # env is frozen -> dup
|
18
18
|
def s.development?; self == 'development';end
|
19
19
|
s
|
20
20
|
end
|
@@ -99,6 +99,6 @@ eof
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def class_name str
|
102
|
-
str.
|
102
|
+
str.parameterize.underscore.camelize
|
103
103
|
end
|
104
104
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "standalone_migrations"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.9"
|
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 = "2012-
|
12
|
+
s.date = "2012-05-10"
|
13
13
|
s.email = "thuss@gabrito.com"
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown"
|
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
]
|
35
35
|
s.homepage = "http://github.com/thuss/standalone-migrations"
|
36
36
|
s.require_paths = ["lib"]
|
37
|
-
s.rubygems_version = "1.8.
|
37
|
+
s.rubygems_version = "1.8.17"
|
38
38
|
s.summary = "A thin wrapper to use Rails Migrations in non Rails projects"
|
39
39
|
|
40
40
|
if s.respond_to? :specification_version then
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: standalone_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-05-10 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement: &
|
17
|
+
requirement: &70316416937560 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70316416937560
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activerecord
|
28
|
-
requirement: &
|
28
|
+
requirement: &70316416936300 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70316416936300
|
37
37
|
description:
|
38
38
|
email: thuss@gabrito.com
|
39
39
|
executables: []
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.17
|
81
81
|
signing_key:
|
82
82
|
specification_version: 3
|
83
83
|
summary: A thin wrapper to use Rails Migrations in non Rails projects
|