Fly Postgres Issues

Created a Fly app using fly launch, added a Postgres database using the workflow however, I’m getting some weird responses with fly commands…

Works

❯ fly postgres list
Update available 0.0.384 -> v0.0.386.
Run "fly version update" to upgrade.
NAME                  OWNER       STATUS     LATEST DEPLOY 
heatbuddy-vapor-db    personal    running    42m20s ago 

Doesn’t Work?

❯ fly postgres config view
Update available 0.0.384 -> v0.0.386.
Run "fly version update" to upgrade.
Error app heatbuddy-vapor is not a postgres app

Already attached…

❯ fly postgres attach heatbuddy-vapor-db --app heatbuddy-vapor
Update available 0.0.384 -> v0.0.386.
Run "fly version update" to upgrade.
Error consumer app "heatbuddy-vapor" already contains a secret named DATABASE_URL

Try specifying the app as the db.

fly postgres config view -a heatbuddy-vapor-db

I see, that seems to have returned a config view. Thank you. Essentially, what I am looking to determine is how I can see if my tables were built from my Vapor app. :thinking:

Try:


fly postgres connect -a heatbuddy-vapor-db
postgres#  \l 
... will list dbs ...
postgres# \c the_db
the_db# \dt
... will list tables ...

If vapor has a migration step like rails, in the fly.toml you can specify a step called deploy to run one-off commands

Thanks tj1, I was able to get the migration to run but ended up with an error when running it.

	 Migrate Command: Prepare
	 [ WARNING ] PSQLError(base: PostgresNIO.PSQLError.Base.sslUnsupported)

Update - Looks like I was able to get it fixed, when migrating from Heroku, I failed to remove my TLS config.

if let urlString = Environment.get("DATABASE_URL" ),
    var postgresConfig = PostgresConfiguration(url: urlString) {
        var tlsConfig = TLSConfiguration.makeClientConfiguration()
        tlsConfig.certificateVerification = .none
        postgresConfig.tlsConfiguration = tlsConfig
        app.databases.use(.postgres(configuration: postgresConfig), as: .psql)