You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to deploy a new PostgresSQL instance into Cloud SQL (GCP) using DbUp and i'm getting this error below:
Beginning database upgrade
Checking whether journal table exists..
Journal table does not exist
Executing Database Server script 'OperationalDatabase.OperationalDbUp.Gateway.Scripts.202209061040-00-gcp_gateway.sql'
Checking whether journal table exists..
Creating the "gateway"."schemaversions" table
DB exception has occured in script: 'OperationalDatabase.OperationalDbUp.Gateway.Scripts.202209061040-00-gcp_gateway.sql'
Script block number: -1; Message: 3F000: schema "gateway" does not exist
Npgsql.PostgresException (0x80004005): 3F000: schema "gateway" does not exist
at Npgsql.NpgsqlConnector.DoReadMessage(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isPrependedMessage)
at Npgsql.NpgsqlConnector.ReadMessage(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications)
at Npgsql.NpgsqlConnector.ReadMessage(Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications)
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.Execute(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at DbUp.Support.TableJournal.EnsureTableExistsAndIsLatestVersion(Func`1 dbCommandFactory)
at DbUp.Support.ScriptExecutor.<>c__DisplayClass18_0.<Execute>b__0(Func`1 dbCommandFactory)
at DbUp.Engine.Transactions.NoTransactionStrategy.Execute(Action`1 action)
at DbUp.Engine.Transactions.DatabaseConnectionManager.ExecuteCommandsWithManagedConnection(Action`1 action)
at DbUp.Support.ScriptExecutor.Execute(SqlScript script, IDictionary`2 variables)
Upgrade failed due to an unexpected exception:
Npgsql.PostgresException (0x80004005): 3F000: schema "gateway" does not exist
CODE
GatewayDbUp:
using System;
using System.Reflection;
using DbUp.Builder;
namespace OperationalDatabase.OperationalDbUp.Gateway
{
public class GatewayDbUp : OperationalDbUpHandler
{
private readonly bool _enabled;
public GatewayDbUp()
{
bool.TryParse(Environment.GetEnvironmentVariable("GATEWAY_DB_UP_ENABLED"), out _enabled);
}
public override void Handle()
{
if (_enabled)
{
UpTables(GetUpgradeEngineBuilder());
}
base.Handle();
}
internal void UpTables(UpgradeEngineBuilder upgradeEngineBuilder)
{
var engine = upgradeEngineBuilder
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly(),
name => name.StartsWith("OperationalDatabase.OperationalDbUp.Gateway.Scripts."))
.JournalToPostgresqlTable("gateway", "schemaversions")
.LogToConsole()
.Build();
CheckUpgrade(engine.PerformUpgrade());
}
}
}
OperationalDbUpHandler: (I have tried to enforce the journal here but it didn't work either)
We've created the gateway schema manually using the same postgresql crecentials that is being used at dbup Environment Variables. The psql user can execute the scripts directly in the console.
DEPLOY TOOLS
docker
docker-compose
k8s
CloudSQL (PostgreSQL v14.0)
TL;DR
DbUp can't create "gateway" schema at 1st deploy
Deploy goes fine when the "gateway" schema is already created or "public" schema already has the table "schemaversions"
I'm trying to deploy a new PostgresSQL instance into Cloud SQL (GCP) using DbUp and i'm getting this error below:
CODE
GatewayDbUp:
OperationalDbUpHandler: (I have tried to enforce the journal here but it didn't work either)
Packages
SCRIPT
Script for file
202209061040-00-gcp_gateway.sql
DEPLOY TOOLS
TL;DR
The text was updated successfully, but these errors were encountered: