File tree 1 file changed +6
-16
lines changed
coderd/database/dbtestutil
1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ func pgDump(dbURL string) ([]byte, error) {
159
159
"pg_dump" ,
160
160
dbURL ,
161
161
"--data-only" ,
162
+ "--column-inserts" ,
162
163
"--no-comments" ,
163
164
"--no-privileges" ,
164
165
"--no-publication" ,
@@ -187,24 +188,13 @@ func filterDump(dump []byte) []byte {
187
188
lines := bytes .Split (dump , []byte {'\n' })
188
189
var buf bytes.Buffer
189
190
for _ , line := range lines {
190
- // Skip blank lines
191
- if len (line ) == 0 {
191
+ // We dump in column-insert format, so these are the only lines
192
+ // we care about
193
+ if ! bytes .HasPrefix (line , []byte ("INSERT" )) {
192
194
continue
193
195
}
194
- // Skip comments
195
- if bytes .HasPrefix (line , []byte ("--" )) {
196
- continue
197
- }
198
- // Skip SELECT or SET statements
199
- if bytes .HasPrefix (line , []byte ("SELECT" )) {
200
- continue
201
- }
202
- if bytes .HasPrefix (line , []byte ("SET" )) {
203
- continue
204
- }
205
-
206
- buf .Write (line )
207
- buf .WriteRune ('\n' )
196
+ _ , _ = buf .Write (line )
197
+ _ , _ = buf .WriteRune ('\n' )
208
198
}
209
199
return buf .Bytes ()
210
200
}
You can’t perform that action at this time.
0 commit comments