Skip to content

Commit

Permalink
Add DatabaseDesired when lauching phoenix app
Browse files Browse the repository at this point in the history
  • Loading branch information
andreolvr committed May 14, 2024
1 parent e4d27e0 commit ec03e00
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scanner/phoenix.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,16 @@ a Postgres database.
`
}

// Add migration task if we find one of the dependencies that would run migrations.
// They are listed here: https://github.com/elixir-ecto/ecto?tab=readme-ov-file#usage
if checksPass(sourceDir, dirContains("mix.exs", "postgrex", "myxql", "tds")) {
if checksPass(sourceDir, dirContains("mix.exs", "postgrex")) {
s.DatabaseDesired = DatabaseKindPostgres
s.ReleaseCmd = "/app/bin/migrate"
} else if checksPass(sourceDir, dirContains("mix.exs", "myxql")) {
s.DatabaseDesired = DatabaseKindMySQL
s.ReleaseCmd = "/app/bin/migrate"
} else if checksPass(sourceDir, dirContains("mix.exs", "tds")) {
s.ReleaseCmd = "/app/bin/migrate"
} else if checksPass(sourceDir, dirContains("mix.exs", "ecto_sqlite3")) {
s.DatabaseDesired = DatabaseKindSqlite
s.Env["DATABASE_PATH"] = "/mnt/name/name.db"

s.Volumes = []Volume{
Expand Down

0 comments on commit ec03e00

Please sign in to comment.