pg-migrator 0.0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +16 -2
- data/lib/{tasks/pg-migrator.rake → pg-migrator/tasks.rb} +2 -1
- data/lib/pg-migrator/version.rb +1 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -8,11 +8,25 @@ Drop ```<timestamp>_desc.sql``` files in ```db/migrations``` (and corresponding
|
|
8
8
|
Gemfile:
|
9
9
|
|
10
10
|
require 'pg-migrator/tasks'
|
11
|
-
|
11
|
+
|
12
|
+
Then make sure that you either have a DATABASE_URL environment variable
|
13
|
+
|
12
14
|
ENV['DATABASE_URL'] = "postgres://user:passwd@host/db"
|
13
|
-
|
15
|
+
|
16
|
+
or if using sockets and default user
|
17
|
+
|
14
18
|
ENV['DATABASE_URL'] = "postgres:db"
|
15
19
|
|
20
|
+
OR define ```db:setup```:
|
21
|
+
|
22
|
+
namespace :db do
|
23
|
+
task :setup => :environment do
|
24
|
+
@migrator = PG::Migrator.new :dbname => 'mydb'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
```PG::Migrator``` takes the same arguments as [PGconn](http://rubydoc.info/gems/pg/0.11.0/PGconn#initialize-instance_method).
|
29
|
+
|
16
30
|
Then as usually:
|
17
31
|
|
18
32
|
rake db:reset # drops the "public" schema in your database (not the database it self or any other schemas)
|
@@ -3,9 +3,10 @@ require 'uri'
|
|
3
3
|
|
4
4
|
namespace :db do
|
5
5
|
task :setup do
|
6
|
+
next unless ENV['DATABASE_URL']
|
6
7
|
uri = URI.parse ENV['DATABASE_URL']
|
7
8
|
if uri.opaque
|
8
|
-
@migrator = PG::Migrator.new
|
9
|
+
@migrator = PG::Migrator.new(:dbname => uri.opaque)
|
9
10
|
else
|
10
11
|
@migrator = PG::Migrator.new(uri.host, uri.port, nil, nil, uri.path.sub(/\//, ''), uri.user, uri.password)
|
11
12
|
end
|
data/lib/pg-migrator/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg-migrator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-10-24 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pg
|
16
|
-
requirement: &
|
16
|
+
requirement: &70197375124040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70197375124040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &70197375123620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70197375123620
|
36
36
|
description: Simple PG Migrator
|
37
37
|
email:
|
38
38
|
- carl.hoerberg@gmail.com
|
@@ -45,8 +45,8 @@ files:
|
|
45
45
|
- README.md
|
46
46
|
- Rakefile
|
47
47
|
- lib/pg-migrator.rb
|
48
|
+
- lib/pg-migrator/tasks.rb
|
48
49
|
- lib/pg-migrator/version.rb
|
49
|
-
- lib/tasks/pg-migrator.rake
|
50
50
|
- pg-migrator.gemspec
|
51
51
|
- spec/migrator_spec.rb
|
52
52
|
homepage: ''
|