pg_comment 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -1
- data/lib/pg_comment/schema_dumper.rb +2 -3
- data/lib/pg_comment/version.rb +1 -1
- data/test/schema_dumper_test.rb +4 -4
- metadata +6 -6
data/README.rdoc
CHANGED
@@ -17,10 +17,9 @@ module PgComment
|
|
17
17
|
unless (comments = @connection.comments(table_name)).empty?
|
18
18
|
comment_statements = comments.map do |row|
|
19
19
|
column_name = row[0]
|
20
|
-
comment = row[1]
|
21
|
-
|
20
|
+
comment = row[1].gsub(/'/, "\\\\'")
|
22
21
|
if column_name
|
23
|
-
" set_column_comment '#{table_name}', '#{column_name}', '#{comment
|
22
|
+
" set_column_comment '#{table_name}', '#{column_name}', '#{comment}'"
|
24
23
|
else
|
25
24
|
" set_table_comment '#{table_name}', '#{comment}'"
|
26
25
|
end
|
data/lib/pg_comment/version.rb
CHANGED
data/test/schema_dumper_test.rb
CHANGED
@@ -8,9 +8,9 @@ require 'pg_comment/schema_dumper'
|
|
8
8
|
class SchemaDumperTest < Test::Unit::TestCase
|
9
9
|
class SchemaDumpContainer
|
10
10
|
def initialize
|
11
|
-
@connection = FakeConnection.new( :comments => [[nil, 'table comment'],
|
11
|
+
@connection = FakeConnection.new( :comments => [[nil, 'table\'s comment'],
|
12
12
|
['c1', 'column1 comment'],
|
13
|
-
['c2', '
|
13
|
+
['c2', 'column\'s comment']] )
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.alias_method_chain(*args)
|
@@ -33,9 +33,9 @@ class SchemaDumperTest < Test::Unit::TestCase
|
|
33
33
|
|
34
34
|
def setup
|
35
35
|
@fake_table = 'my_table'
|
36
|
-
@expected = [" set_table_comment '#{@fake_table}', 'table comment'",
|
36
|
+
@expected = [" set_table_comment '#{@fake_table}', 'table\\'s comment'",
|
37
37
|
" set_column_comment '#{@fake_table}', 'c1', 'column1 comment'",
|
38
|
-
" set_column_comment '#{@fake_table}', 'c2', '
|
38
|
+
" set_column_comment '#{@fake_table}', 'c2', 'column\\'s comment'"].join("\n")
|
39
39
|
end
|
40
40
|
|
41
41
|
def test_dump_comments
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg_comment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-09-
|
12
|
+
date: 2011-09-12 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
16
|
-
requirement: &
|
16
|
+
requirement: &18118440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *18118440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: test-unit
|
27
|
-
requirement: &
|
27
|
+
requirement: &18117980 !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: *18117980
|
36
36
|
description: Adds helper methods to migrations and pulls out comments into schema.rb
|
37
37
|
email:
|
38
38
|
- arthur.shagall@gmail.com
|