Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/pg-schema-diff/apply_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func (suite *cmdTestSuite) TestApplyCmd() {
})
// The migration should have been successful. Assert it was.
expectedDb := tempDbWithSchema(suite.T(), suite.pgEngine, tc.expectedSchemaDDL)
expectedDbDump, err := pgdump.GetDump(expectedDb, pgdump.WithSchemaOnly())
expectedDbDump, err := pgdump.GetDump(expectedDb, pgdump.WithSchemaOnly(), pgdump.WithRestrictKey("test"))
suite.Require().NoError(err)
fromDbDump, err := pgdump.GetDump(fromDb, pgdump.WithSchemaOnly())
fromDbDump, err := pgdump.GetDump(fromDb, pgdump.WithSchemaOnly(), pgdump.WithRestrictKey("test"))
suite.Require().NoError(err)

suite.Equal(expectedDbDump, fromDbDump)
Expand Down
6 changes: 6 additions & 0 deletions internal/pgdump/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ func WithSchemaOnly() Parameter {
}
}

func WithRestrictKey(restrict_key string) Parameter {
return Parameter{
values: []string{"--restrict-key", restrict_key},
}
}

// GetDump gets the pg_dump of the inputted database.
// It is only intended to be used for testing. You cannot securely pass passwords with this implementation, so it will
// only accept databases created for unit tests (spun up with the pgengine package)
Expand Down
Loading