pg-migrator 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pg-migrator.rb CHANGED
@@ -5,8 +5,13 @@ require 'logger'
5
5
 
6
6
  module PG
7
7
  class Migrator
8
- def initialize(database_url, migrations_dir = './db/migrations', logger = Logger.new(STDOUT))
9
- @pg = PGconn.connect database_url
8
+ def initialize(conn, migrations_dir = './db/migrations', logger = Logger.new(STDOUT))
9
+ @pg =
10
+ if conn.is_a? PGconn
11
+ conn
12
+ else
13
+ PGconn.connect conn
14
+ end
10
15
  @pg.exec 'SET client_min_messages = warning'
11
16
  @migrations_dir = migrations_dir
12
17
  @log = logger
@@ -1,5 +1,5 @@
1
1
  module PG
2
2
  class Migrator
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
@@ -9,6 +9,10 @@ describe PG::Migrator do
9
9
  @migrator = PG::Migrator.new({:dbname => 'pg-migrator'}, '/tmp', logger)
10
10
  end
11
11
 
12
+ it 'can be initialized with a pgconn' do
13
+ PG::Migrator.new(@pg)
14
+ end
15
+
12
16
  describe 'reset' do
13
17
  it 'deletes previous tables' do
14
18
  @pg.exec 'create table bar (id int)'
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.1.0
4
+ version: 1.1.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-10-24 00:00:00.000000000Z
12
+ date: 2011-10-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &70154890788080 !ruby/object:Gem::Requirement
16
+ requirement: &70324143022020 !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: *70154890788080
24
+ version_requirements: *70324143022020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: minitest
27
- requirement: &70154890787660 !ruby/object:Gem::Requirement
27
+ requirement: &70324143021600 !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: *70154890787660
35
+ version_requirements: *70324143021600
36
36
  description: Rake migration tasks which utilities pure SQL files
37
37
  email:
38
38
  - carl.hoerberg@gmail.com