From 4c91ac3bfde04bf99eb26d6794a8cbe9b374c534 Mon Sep 17 00:00:00 2001 From: Bert Scholten Date: Tue, 30 Aug 2022 10:57:26 +0200 Subject: [PATCH 1/2] Allow schema and table to have the same name As it was, comments couldn't be added to tables that had the same name as the schema they were in (for instance, calculations.calculations). Think the only reason not to do this would be if the object type was a SCHEMA, so changed the check to work on that. --- bin/CommentCollector.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/CommentCollector.rb b/bin/CommentCollector.rb index c8be021..0e78e19 100644 --- a/bin/CommentCollector.rb +++ b/bin/CommentCollector.rb @@ -2,7 +2,7 @@ # Representation of a parsed comment for a database object # class CommentItem - attr_accessor :identifier_noschema, :schema, :arguments, :arguments_nodefault + attr_accessor :identifier_noschema, :schema, :object, :arguments, :arguments_nodefault attr_accessor :full_comment, :parsed_comment attr_accessor :params, :columns attr_accessor :returns, :see, :todo, :file @@ -15,7 +15,7 @@ def initialize end def identifier - if @schema == '' || @schema == @identifier_noschema then + if @schema == '' || @object == 'SCHEMA' then @identifier_noschema else @schema + '.' + @identifier_noschema @@ -160,6 +160,7 @@ def self.fix_wrapping(comment_lines) def self.create_comment_item(object, identifier, arguments) comment_item = CommentItem.new + comment_item.object = object comment_item.identifier_noschema = identifier.include?('.') ? identifier.split('.')[1] : identifier comment_item.schema = identifier.include?('.') ? identifier.split('.')[0] : '' comment_item.schema = identifier if object == 'SCHEMA' From 1638226e0b9f60f50f48865979fa9860f2915db5 Mon Sep 17 00:00:00 2001 From: Bert Scholten Date: Tue, 30 Aug 2022 11:00:37 +0200 Subject: [PATCH 2/2] tab to spaces --- bin/CommentCollector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/CommentCollector.rb b/bin/CommentCollector.rb index 0e78e19..442343c 100644 --- a/bin/CommentCollector.rb +++ b/bin/CommentCollector.rb @@ -160,7 +160,7 @@ def self.fix_wrapping(comment_lines) def self.create_comment_item(object, identifier, arguments) comment_item = CommentItem.new - comment_item.object = object + comment_item.object = object comment_item.identifier_noschema = identifier.include?('.') ? identifier.split('.')[1] : identifier comment_item.schema = identifier.include?('.') ? identifier.split('.')[0] : '' comment_item.schema = identifier if object == 'SCHEMA'