🃏
Bard.Db
  • Introduction
  • Installation
  • Databases
    • Microsoft SQL
    • PostgreSQL
Powered by GitBook
On this page
  • Creating a PostgreSQL Server instance.
  • Starting up the Database
  • Stopping the Database

Was this helpful?

Export as PDF
  1. Databases

PostgreSQL

This section describes how to start up an instance of a PostgreSQL Server database.

Creating a PostgreSQL Server instance.

Create a new instance of Bard.Db.PostgresDatabasepassing in the database name, username , password and port number.

var db = new PostgresDatabase(
    databaseName: "PostgreSQL_latest",
    postgresUser: "Db_user",
    password: "Password1",
    portNumber: "5432",
    tagName: "latest");

Port number, and tagName are optional. If they are not supplied then the default value is

latest & 5432

Starting up the Database

To start the database instance simply call either. The result is the IP address of the host machine in case this is needed in the connection string.

var result = db.StartDatabase();
var result = await db.StartDatabaseAsync();

This may take a little time the first time as Docker needs to download the image in the background.

Stopping the Database

To stop the database simply call.

 db.StopDatabase();
await db.StopDatabaseAsync();
PreviousMicrosoft SQL

Last updated 4 years ago

Was this helpful?