Dbup(.net library) with Powershell for Postgresql

475 views Asked by At

With the reference of this link I am trying to run dbup through powershell script for the Postgresql DB. But, stuck with an error- enter image description here

Powershell script-

$scriptPath = $args['H:\HelloDbUp\Scripts']
[Reflection.Assembly]::LoadFrom("H:\HelloDbUp\packages\dbup-postgresql.4.2.0\lib\net45\dbup-postgresql.dll")
$dbUp = [DbUp.DeployChanges]::To
$dbUp = [PostgresqlServerExtensions]::PostgresqlDatabase($dbUp, "server=serverName;Port=5432;database=DevOps_TestDB;User ID=postgres;Password=77777;Trusted_Connection=Yes;Connection Timeout=120;")
$dbUp = [StandardExtensions]::WithScriptsFromFileSystem($dbUp, $scriptPath)
$dbUp = [PostgresqlServerExtensions]::JournalToSqlTable($dbUp, 'MySchema', 'MyTable')
$dbUp = [StandardExtensions]::LogToConsole($dbUp)
$upgradeResult = $dbUp.Build().PerformUpgrade()

Please help me to get out of this Error !

1

There are 1 answers

0
Nitin Jain On

Can you try with below :

Add-Type -Path 'H:\HelloDbUp\packages\dbup-postgresql.4.2.0\lib\net45\dbup-postgresql.dll'

I also face same error, adding above it solved.