pg_comment 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,6 +56,15 @@ module PgComment
56
56
  def remove_column_comment(column_name)
57
57
  @base.remove_column_comment(@table_name, column_name)
58
58
  end
59
+
60
+ # Removes any comments from the given columns
61
+ #
62
+ # ===== Example
63
+ # ====== Remove comment from the npa and nxx columns
64
+ # t.remove_column_comment :npa, :nxx
65
+ def remove_column_comments(*column_names)
66
+ @base.remove_column_comments(@table_name, *column_names)
67
+ end
59
68
  end
60
69
  end
61
70
  end
@@ -60,6 +60,15 @@ module PgComment
60
60
 
61
61
  end
62
62
 
63
+ # Removes any comment from the given columns of a given table.
64
+ #
65
+ # ===== Example
66
+ # ====== Removing comment from the npa and nxx columns of table phone_numbers
67
+ # remove_column_comments :phone_numbers, :npa, :nxx
68
+ def remove_column_comments(table_name, *column_names)
69
+
70
+ end
71
+
63
72
  end
64
73
  end
65
74
  end
@@ -30,6 +30,12 @@ module PgComment
30
30
  sql = "COMMENT ON COLUMN #{quote_table_name(table_name)}.#{quote_column_name(column_name)} IS NULL;"
31
31
  execute sql
32
32
  end
33
+
34
+ def remove_column_comments(table_name, *column_names)
35
+ column_names.each do |column_name|
36
+ remove_column_comment table_name, column_name
37
+ end
38
+ end
33
39
  =begin
34
40
  --Fetch all comments
35
41
  SELECT c.relname as table_name, a.attname as column_name, d.description as comment
@@ -13,10 +13,18 @@ module PgComment
13
13
  record(:set_column_comment, args)
14
14
  end
15
15
 
16
+ def set_column_comments(*args)
17
+ record(:set_column_comments, args)
18
+ end
19
+
16
20
  def remove_column_comment(*args)
17
21
  record(:remove_column_comment, args)
18
22
  end
19
23
 
24
+ def remove_column_comments(*args)
25
+ record(:remove_column_comments, args)
26
+ end
27
+
20
28
  def invert_set_table_comment(args)
21
29
  table_name = args.first
22
30
  [:remove_table_comment, [table_name]]
@@ -27,6 +35,11 @@ module PgComment
27
35
  column_name = args[1]
28
36
  [:remove_column_comment, [table_name, column_name]]
29
37
  end
38
+
39
+ def invert_set_column_comments(args)
40
+ i_args = [args[0]] + args[1].collect{|name, value| name }
41
+ [:remove_column_comments, i_args]
42
+ end
30
43
  end
31
44
  end
32
45
  end
@@ -1,3 +1,3 @@
1
1
  module PgComment
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
- requirement: &7406540 !ruby/object:Gem::Requirement
16
+ requirement: &7923860 !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: *7406540
24
+ version_requirements: *7923860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: test-unit
27
- requirement: &7405880 !ruby/object:Gem::Requirement
27
+ requirement: &7922760 !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: *7405880
35
+ version_requirements: *7922760
36
36
  description: Extends Rails migrations to support setting column and table comments. Pulls
37
37
  out comments into schema.rb
38
38
  email: