sql-archiver

command module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 1 Imported by: 0

README

SQL Archiver

SQL Archiver is an interactive TUI tool for backing up and restoring MSSQL databases from Docker MSSQL containers, using .bak files.

Installation

Install via the Go CLI:

go install github.com/Eventid3/sql-archiver@latest

Or build from source:

git clone https://github.com/Eventid3/sql-archiver
cd sql-archiver
make build          # binary written to build/sql-archiver
make install        # copies binary to ~/go/bin

Usage

Run the tool and the TUI will start:

sql-archiver

On first launch you will see a blank login form. Fill in the SQL Server host (localhost:1433 by default), username, and password, then press Enter.

After a successful login you will be asked to name and save the connection. Saved connections appear in the picker at the top of the login screen on subsequent launches, so you can connect with a single key-press.

Keyboard shortcuts — login screen
Key Action
/ Navigate saved-connection list
Enter Select a saved connection (pre-fills the form)
n New connection (clears the form)
d Delete the highlighted saved connection
y / any key Confirm / cancel the delete prompt
Tab / Advance focus to the next form field
Shift+Tab / Move focus to the previous form field
Esc Return from the form to the saved-connection picker
Ctrl+C Quit
Backup files

Backup files must be placed in /var/opt/mssql/backup/ inside the Docker container for the tool to access them. The tool reads this directory via the SQL Server sys.dm_os_enumerate_filesystem DMV (requires SQL Server 2019+).

Saved connections

Connections are stored in $HOME/.config/sql-archiver/config.yaml:

connections:
  - name: local
    host: localhost:1433
    user: sa
    password: SomeStrongP@ssw0rd
  - name: staging
    host: staging.internal:1433
    user: sa
    password: AnotherPassword

You can edit this file manually or let the TUI manage it. Passwords are stored in plain text — only use saved connections in trusted, non-production environments.

Development

make test           # run all tests
make test-verbose   # run all tests with verbose output
make test-cover     # generate coverage report (coverage.html)
go vet ./...        # static analysis

Run a single test:

go test ./interactive/ -run TestParentModel_FullBackupFlow
go test ./mssql/      -run TestInspectBackupFile_WindowsPathWithSpaces

Documentation

Overview

Copyright © 2025 Esben Inglev <esbeninglev@gmail.com>

Directories

Path Synopsis
Package cmd Copyright © 2025 Esben Inglev <esbeninglev@gmail.com>
Package cmd Copyright © 2025 Esben Inglev <esbeninglev@gmail.com>
Package config manages the sql-archiver configuration file.
Package config manages the sql-archiver configuration file.
Package domain
Package domain
Package interactive implements an interactive command-line interface using the Bubble Tea framework.
Package interactive implements an interactive command-line interface using the Bubble Tea framework.
Package mssql
Package mssql

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL