diff --git a/api/databases.ts b/api/databases.ts index 4ac41be..fa8e9eb 100644 --- a/api/databases.ts +++ b/api/databases.ts @@ -190,9 +190,19 @@ export async function pushSchema( env: { ...process.env, FOFOS_ENV: target, - // Both, because which one their guard reads depends on FOFOS_ENV and setting only one would - // work for a single target by accident. ...(target === 'production' ? { POSTGRES_URL: url.toString() } : { POSTGRES_URL_DEV: url.toString() }), + /* + BOTH expected names, whichever target this is. + + Their guard checks that the two environments expect different databases, so it needs both to do + that at all — and passing only the one being pushed to would leave the other falling back to the + name the repository shipped with, which is a comparison against something nobody configured. + + These are the names stored here, which makes this plugin the authority on what the site's + databases are called. That is the point of the change: the site stopped hardcoding them. + */ + ...(status.production.name ? { FOFOS_DB_PRODUCTION: status.production.name } : {}), + ...(status.development.name ? { FOFOS_DB_DEVELOPMENT: status.development.name } : {}), }, stdout: 'pipe', stderr: 'pipe',