pg-migrator 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,13 +3,21 @@ require 'uri'
3
3
 
4
4
  namespace :db do
5
5
  task :setup do
6
- next unless ENV['DATABASE_URL']
6
+ next if @migrator
7
+ next if ENV['DATABASE_URL'].nil?
7
8
  uri = URI.parse ENV['DATABASE_URL']
8
- if uri.opaque
9
- @migrator = PG::Migrator.new(:dbname => uri.opaque)
10
- else
11
- @migrator = PG::Migrator.new(uri.host, uri.port, nil, nil, uri.path.sub(/\//, ''), uri.user, uri.password)
12
- end
9
+ conn_hash =
10
+ if uri.opaque
11
+ { :dbname => uri.opaque }
12
+ else
13
+ { :host => uri.host,
14
+ :port => uri.port || 5432,
15
+ :dbname => uri.path[1..-1],
16
+ :user => uri.user,
17
+ :password => uri.password
18
+ }
19
+ end
20
+ @migrator = PG::Migrator.new conn_hash
13
21
  end
14
22
 
15
23
  desc 'Drops all schemas currently in the search_path and then applies all the migrations'
@@ -1,5 +1,5 @@
1
1
  module PG
2
2
  class Migrator
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.1"
4
4
  end
5
5
  end
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: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-04 00:00:00.000000000 Z
12
+ date: 2011-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &70326906755800 !ruby/object:Gem::Requirement
16
+ requirement: &70334490073660 !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: *70326906755800
24
+ version_requirements: *70334490073660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70326906755380 !ruby/object:Gem::Requirement
27
+ requirement: &70334490072440 !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: *70326906755380
35
+ version_requirements: *70334490072440
36
36
  description: Rake migration tasks which utilities pure SQL files
37
37
  email:
38
38
  - carl.hoerberg@gmail.com