-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move logic for the
status
command into the state
and migrations
…
… packages (#205) Move the logic for the `pgroll status` command out of the CLI and into the `migrations` and `state` package and add tests for it. This makes it possible to consume migration status information from packages using `pgroll` as a module.
- Loading branch information
1 parent
34bbb24
commit 763dabc
Showing
5 changed files
with
132 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package state | ||
|
||
type MigrationStatus string | ||
|
||
const ( | ||
NoneMigrationStatus MigrationStatus = "No migrations" | ||
InProgressMigrationStatus MigrationStatus = "In progress" | ||
CompleteMigrationStatus MigrationStatus = "Complete" | ||
) | ||
|
||
// Status describes the current migration status of a database schema. | ||
type Status struct { | ||
// The schema name. | ||
Schema string `json:"schema"` | ||
|
||
// The name of the latest version schema. | ||
Version string `json:"version"` | ||
|
||
// The status of the most recent migration. | ||
Status MigrationStatus `json:"status"` | ||
} |