Skip to content

Commit 0cc1c91

Browse files
Merge branch 'main' into bplunkett/sql-format
2 parents 82e1a87 + ce93f35 commit 0cc1c91

26 files changed

+2382
-98
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ assignees: ''
88
---
99

1010
### Describe the bug**
11-
[//]: # A clear and concise description of what the bug is.
11+
<!-- A clear and concise description of what the bug is. -->
1212

1313
### Expected behavior**
14-
[//]: # A clear and concise description of what you expected to happen.
14+
<!-- A clear and concise description of what you expected to happen. -->
1515

1616
### To Reproduce
17-
[//]: # Steps to reproduce the behavior:
18-
[//]: # 1. Go to '...'
19-
[//]: # 2. Click on '....'
20-
[//]: # 3. Scroll down to '....'
21-
[//]: # 4. See error
17+
<!-- Steps to reproduce the behavior:
18+
1. Go to '...'
19+
2. Click on '....'
20+
3. Scroll down to '....'
21+
4. See error -->
2222

2323
### Context
24-
[//]: # Fetch from "pg-schema-diff version" if using the CLI or go.mod if using the library
24+
<!-- Fetch from "pg-schema-diff version" if using the CLI or go.mod if using the library -->
2525
pg-schema-diff version: Some sha or version
26-
[//]: # If you are using the CLI or using the library programatically
26+
<!-- If you are using the CLI or using the library programatically -->
2727
pg-schema-diff usage: [CLI | LIBRARY]
2828
Postgres version: [14, 15, 16, 17]
29-
[//]: # Only if relevant
29+
<!-- Only if relevant -->
3030
pg_dump of database: Gist link
3131

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ assignees: ''
88
---
99

1010
### Describe the feature
11-
[//]: # Provide a thorough description of the feature. If possible, include examples of the feature and its behavior. For example, if it's a new command flag, provide examples of using the command flag and expected outputs.
11+
<!-- Provide a thorough description of the feature. If possible, include examples of the feature and its behavior. For example, if it's a new command flag, provide examples of using the command flag and expected outputs. -->
1212

1313
### Motivation
14-
[//]: # Describe why you want this feature. This is important for assessing the priority of the feature and if alternative solutions exist.
14+
<!-- Describe why you want this feature. This is important for assessing the priority of the feature and if alternative solutions exist. -->

.github/pull_request_template.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
[//]: # README: Ensure you've read the CONTRIBUTING.MD and that your commits are signed
1+
<!-- README: Ensure you've read the CONTRIBUTING.MD and that your commits are signed -->
22

33
### Description
4-
[//]: # A clear and concise description of the purpose of this Pull Request. What is being changed? Include any relevant background for this change.
4+
<!-- A clear and concise description of the purpose of this Pull Request. What is being changed? Include any relevant background for this change. -->
55

66
### Motivation
7-
[//]: # Why you made these changes. Link to any relevant issues.
7+
<!-- Why you made these changes. Link to any relevant issues. -->
88

99
### Testing
10-
[//]: # Describe how you tested these changes
10+
<!-- Describe how you tested these changes -->

.sqlfluff

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[sqlfluff]
22
dialect = postgres
33
templater = placeholder
4+
large_file_skip_byte_limit = 0
45

56
[sqlfluff:templater:placeholder]
67
param_regex = sqlc.arg\(.*\)

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,11 @@ for _, stmt := range plan.Statements {
171171
```
172172

173173
# Supported Postgres versions
174-
Supported: 14, 15, 16, 17
174+
Supported: 14, 15, 16, 17
175175
Unsupported: <= 13 are not supported. Use at your own risk.
176176

177177
# Unsupported migrations
178178
An abridged list of unsupported migrations:
179-
- Views (Planned)
180179
- Privileges (Planned)
181180
- Types (Only enums are currently supported)
182181
- Renaming. The diffing library relies on names to identify the old and new versions of a table, index, etc. If you rename

cmd/pg-schema-diff/apply_cmd_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ func (suite *cmdTestSuite) TestApplyCmd() {
7878
})
7979
// The migration should have been successful. Assert it was.
8080
expectedDb := tempDbWithSchema(suite.T(), suite.pgEngine, tc.expectedSchemaDDL)
81-
expectedDbDump, err := pgdump.GetDump(expectedDb, pgdump.WithSchemaOnly())
81+
expectedDbDump, err := pgdump.GetDump(expectedDb, pgdump.WithSchemaOnly(), pgdump.WithRestrictKey(pgdump.FixedRestrictKey))
8282
suite.Require().NoError(err)
83-
fromDbDump, err := pgdump.GetDump(fromDb, pgdump.WithSchemaOnly())
83+
fromDbDump, err := pgdump.GetDump(fromDb, pgdump.WithSchemaOnly(), pgdump.WithRestrictKey(pgdump.FixedRestrictKey))
8484
suite.Require().NoError(err)
8585

8686
suite.Equal(expectedDbDump, fromDbDump)

cmd/pg-schema-diff/datastructs.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package main
33
import (
44
"fmt"
55
"sort"
6+
7+
"github.com/stripe/pg-schema-diff/internal/util"
68
)
79

810
func mustGetAndDeleteKey(m map[string]string, key string) (string, error) {
@@ -15,10 +17,7 @@ func mustGetAndDeleteKey(m map[string]string, key string) (string, error) {
1517
}
1618

1719
func keys(m map[string]string) []string {
18-
var vals []string
19-
for k := range m {
20-
vals = append(vals, k)
21-
}
20+
vals := util.Keys(m)
2221
sort.Strings(vals)
2322
return vals
2423
}

cmd/pg-schema-diff/datastructs_test.go

Lines changed: 0 additions & 42 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ require (
66
github.com/go-logfmt/logfmt v0.6.0
77
github.com/google/go-cmp v0.5.9
88
github.com/google/uuid v1.3.0
9+
github.com/hashicorp/go-version v1.7.0
910
github.com/jackc/pgx/v4 v4.18.2
1011
github.com/kr/pretty v0.3.1
1112
github.com/lib/pq v1.10.2

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
2929
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
3030
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
3131
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
32+
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
33+
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
3234
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3335
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
3436
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=

0 commit comments

Comments
 (0)