Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix migratedown target #858

Merged
merged 1 commit into from
Sep 5, 2023
Merged
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
3 changes: 2 additions & 1 deletion cmd/server/app/migrate_down.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"fmt"
"os"
"path/filepath"

"github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/postgres" // nolint
Expand Down Expand Up @@ -67,7 +68,7 @@ var downCmd = &cobra.Command{
}
}

configPath := os.ExpandEnv("file://${KO_DATA_PATH}/database/migrations")
configPath := "file://" + filepath.Join(os.Getenv("KO_DATA_PATH"), "database/migrations")
m, err := migrate.New(configPath, connString)
if err != nil {
fmt.Printf("Error while creating migration instance (%s): %v\n", configPath, err)
Expand Down
8 changes: 8 additions & 0 deletions database/migrations/000001_init.down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
-- limitations under the License.


DROP TABLE IF EXISTS artifact_versions;
DROP TABLE IF EXISTS rule_evaluation_status;
DROP TABLE IF EXISTS artifacts;
DROP TABLE IF EXISTS entity_policies;
DROP TABLE IF EXISTS policy_status;
DROP TABLE IF EXISTS signing_keys;
DROP TABLE IF EXISTS rule_type;
DROP TABLE IF EXISTS policies;
DROP TABLE IF EXISTS session_store;
DROP TABLE IF EXISTS repositories;
DROP TABLE IF EXISTS provider_access_tokens;
Expand Down