goose icon indicating copy to clipboard operation
goose copied to clipboard

not comments added

Open qinritukou opened this issue 5 years ago • 4 comments

It seemed not comments added by ddl was added to server. I'm using postgres.

qinritukou avatar Jan 20 '20 02:01 qinritukou

Comments identified by "--" seem to get added for me, no problem (postgresql 11)

However, blank lines disappear. I'm creating an issue about this.

jflambert avatar Jan 28 '20 16:01 jflambert

@qinritukou can you confirm this is still an issue?

If so, what postgres version? Do you have a basic example of observed vs expected?

There is a sep. ticket on empty lines.. #200

mfridman avatar Feb 01 '20 14:02 mfridman

What I have found is that it seems to keep -- single line comments (at least when there is no blank row after it), but seems to remove multi line -- comments, especially if they have blank rows above/after them. This issue and the white space/blank row issue seems to both have been coming in version 2.7.0. Prior to this, I think all comments and white space was preserved correctly.

Here you can see an example. Left hand is the original function, and right hand is what is actually getting inserted in the db by goose, where you can see single line comment preserved, multi line and blank row/white space removed:

image

tvarsis avatar Feb 12 '21 10:02 tvarsis

This is a pretty big issue, since I think many people might have the same workflow as me, or at least, want to be able to rely on diff tools. My workflow is this: Do a db diff with a diff tool -> Generate and validate migration scripts -> Run migrations with Goose

The problem with not using the same comment structure with the same white space, is that all of those comments/functions etc will then again show up in the db diff, even though they are actually suppose to be identical. Goose changing of white space and comments breaks the whole db diff flow to be able to detect differences between migrations.

tvarsis avatar Mar 06 '21 18:03 tvarsis