Database Management

DB Connection

DB connection string format: <protocol>://<username>:<password>@<host>:<port>/<database>?<options>

  • protocol: database type. postgresql, mondodb, mysql etc.
  • username and password: db user account
  • host and port: host or ip address + port of the db server
  • database: name of the db
  • options: additional query parameters - SSL settings, timeouts etc.

Migrations

Incremental, versioned changes to DB schema - similar to code commits.

Migration can define:

  • Adding/modifying/dropping tables
  • Adding/modifying/dropping columns
  • Creating or changing indexes, constraints
  • Sometimes even inserting or updating seed data

Baselining a database

Baselining tells a migration tool to consider the current state of the db as the base. And not to track the previous changes.

This is typically used when you are starting to use a new db tool for an existing database and you might already have tables and data.

If you don't want to re-apply those changes as migrations, you use baselining to tell the tool: “Start version tracking from here. Assume the current schema reflects migration X.”

So the tool won't try to re-run or apply older migrations, avoiding conflicts or errors.

© 2025 All rights reservedBuilt with Flowershow Cloud

Built with LogoFlowershow Cloud