sqlitekit

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT-0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

sqlitekit

The SQLite settings and routines an application should not get slightly wrong on its own: a connection string that turns on what SQLite has off, a startup check that the driver really applied it, dated online backups with retention, and a goose adapter for STRICT tables. The root package uses only the standard library and imports no driver.

import "github.com/17xande-dev/sqlitekit"

It targets modernc.org/sqlite, the pure-Go driver (driver name sqlite, builds with CGO_ENABLED=0). Your application imports the driver; this module does not.

Opening a database

import (
    "database/sql"

    _ "modernc.org/sqlite"

    "github.com/17xande-dev/sqlitekit"
)

o := sqlitekit.Options{} // BusyTimeout 0 means 5s; SecureDelete is off
dsn, err := sqlitekit.DSN("data/notes.db", o)
if err != nil { /* ... */ }
db, err := sql.Open("sqlite", dsn)
if err != nil { /* ... */ }
if err := sqlitekit.Check(ctx, db, o); err != nil {
    log.Fatal(err) // a setting did not take effect: refuse to run
}

DSN makes the path absolute and escapes it as a file: URL, so a space, ? or # in a directory name is part of the path and never becomes driver configuration. It passes the settings as _pragma parameters, which the driver runs on every connection it opens, so every connection in the pool has them. ":memory:" and file: URLs are not supported: it is a file path.

Why each setting
  • foreign_keys(1). SQLite enforces no foreign key by default. Every REFERENCES in a schema is decoration until a connection turns it on, and the delete you thought was refused quietly orphans rows.
  • busy_timeout(5000). With no timeout a connection that meets a lock held by another fails at once with SQLITE_BUSY. That is usually the write that saves someone's submission. The timeout makes it wait instead.
  • journal_mode(WAL). Readers no longer block the writer, and the writer no longer blocks readers. The costs are real, see WAL and backups: it needs a writable local directory (it adds -wal and -shm files), it is unsafe on network filesystems, and a plain copy of the .db file is no longer a backup. WAL is stored in the database file, so it stays on once set.
  • _txlock=immediate. A deferred transaction takes the write lock only at its first write. If another connection holds it, a transaction that has already read fails at once with "database is locked", and the busy timeout does not apply to that upgrade. An immediate transaction takes the lock at BEGIN, where the timeout does wait. This is a driver option, not a SQLite setting.
  • secure_delete(1), optional. Deleted content is overwritten with zeros instead of lingering in free pages, in the live file and in any backup made from it. It costs some write speed. Set Options.SecureDelete only where deleted data must not survive.

Synchronous mode is left at SQLite's default (FULL), which keeps a committed transaction durable across power loss.

Check

Check reads foreign_keys, journal_mode, busy_timeout and (when set) secure_delete on one pooled connection and returns an error naming each mismatch. Call it once at startup. A misspelled parameter, or a driver that ignores it, would otherwise run for months unnoticed, and now fails the boot.

Two limits. It cannot see _txlock, which is not stored anywhere SQLite can be asked about; the package's tests prove it by showing that a second connection cannot write while a transaction is open. And journal_mode is stored in the file: a database that was ever in WAL reports wal even if this connection was opened without the setting, so a passing Check on an old file proves the file, not the connection string. DSN is what sets it.

Backups

b := sqlitekit.Backups{
    Dir:    "data/backups",
    Prefix: "notes-",
    Layout: "2006-01-02", // notes-2026-10-05.db
    Keep:   14,
}
path, made, err := b.Run(ctx, db, time.Now())

Call Run for a one-off backup, or use Start below to schedule it. Run writes one backup per calendar day: if today's exists it only prunes, and made is false. Location picks the time zone that decides the day (nil is UTC). List returns the backups newest first.

  • A backup is VACUUM INTO a hidden temporary file (.<name>.tmp) that Run creates itself, exclusively and with mode 0600, before SQLite writes to it, then syncs and renames into place. The copy is never readable by anyone else, not even while it is being written, and a file or symlink planted at the temporary name fails the run instead of being written through. A crash never produces a half-written file under a name that looks like the day's backup. Temporary files left by crashes, of any day, are removed at the start of the next run. Dir is created 0700 and set to 0700 on every run, so an existing, looser directory is tightened.
  • A symlink or other non-regular file named as today's backup is an error, not "already made", and symlinks are never listed or pruned.
  • Retention keeps the newest Keep backups, by date. Keep below 1 counts as 1. The backup just made is never pruned.
  • Only files named exactly Prefix + <a date in Layout> + ".db" are listed or pruned. The text between prefix and .db must parse as a date in Layout and format back to the same text, so notes-latest.db, notes-2026-13-45.db, -wal files and anything else in the directory are never removed. (Pruning only touches backups, but Dir is still not a place to share: see below.)
  • Dir must be a folder the process owns and that holds nothing but this application's backups. It is made private (0700) on every run, because a backup holds the whole database; if the process cannot do that (the folder belongs to someone else, or it is on a filesystem that refuses chmod), Run fails with an error rather than carry on with a readable folder.
  • Do not call Run concurrently for the same Dir and Prefix: use one caller, such as a single daily loop. Two overlapping calls race on the same temporary file, so one can fail; the backup under today's name is never left half written, and stays good.
  • Prefix must not be empty. Layout must name a full date, year, month and day, one name per day (for example 2006-01-02, 20060102 or 2006_01_02). A layout without a year (01-02, Jan 2) would repeat a name a year later and silently stop backups, so it is rejected, as are layouts that would name a backup per hour, skip days, or contain a path separator.

Backups sit next to the database, in the same volume. They protect against a mistaken delete or a corrupted file, not against losing the disk. Copying them somewhere else is a separate decision.

Running backups on a schedule
loop, err := b.Start(ctx, db, sqlitekit.BackupSchedule{
    LockPath: "data/notes.db.backup-lock",
    Report: func(r sqlitekit.BackupResult) {
        if r.Err != nil {
            log.Printf("backup: %v; retrying in %s", r.Err, r.Next)
        }
    },
})
if err != nil { return err }
// At shutdown:
loop.Stop()
return db.Close()
  • Start validates the settings before starting. The first run is immediate. After success it waits one hour by default; after failure the default wait is 15 minutes or Interval, whichever is shorter. A custom Retry cannot exceed Interval or one hour.
  • Each run has a five-minute timeout by default, including the wait for the optional lock. Report lets the application decide what to log. A run interrupted by shutdown is not reported; a run that fails at its deadline is reported with a deadline error.
  • One goroutine runs the schedule, so the one-caller rule holds within the process. Set the same LockPath in overlapping processes, such as when a deploy starts a new container before stopping the old one. Use a dedicated lock file outside the backup folder. It stays in place and must not be the migration lock, the database file, or its -wal or -shm files. Start rejects LockPath on platforms without flock.
  • Call Stop before closing the database. It cancels the current run and waits for the goroutine, including any Report in progress. Both Stop and Done are safe on a nil *BackupLoop or a zero BackupLoop, either of which can represent backups being turned off.

Why schedule this in the application? Run uses the application's open database to execute VACUUM INTO, so this loop needs no separate cron job. It makes no backups while the application is down; the startup run catches up when the application returns.

WAL and backups

In WAL mode, recent commits live in the -wal file until a checkpoint copies them into the .db file. Copying the .db file of a running application (cp, docker cp, a volume tarball) can therefore miss committed data or capture a torn state. Take backups with VACUUM INTO (what Backups does), the SQLite backup API, or sqlite3 data.db ".backup out.db", or stop the application first and copy the .db file together with its -wal and -shm files.

Migrations with goose: goosestrict

import "github.com/17xande-dev/sqlitekit/goosestrict"

This subpackage is the only part that depends on pressly/goose/v3.

Goose's SQLite store creates its version table with a TIMESTAMP column, which a STRICT table rejects. So that the version table is STRICT like the rest:

migrations, _ := fs.Sub(embeddedMigrations, "migrations")
p, err := goosestrict.NewProvider(db, migrations)
if err != nil { /* refused: see below */ }
_, err = p.Up(ctx)
  • NewStore is goose's SQLite version store with a STRICT version table. It also answers "does the version table exist" from sqlite_master. Goose's default asks whether version 0 is recorded, so a version table without that row (adopted, or repaired by hand) looks absent and goose tries to create it again.
  • NewProvider builds a goose provider on that store and does not run Up. It refuses a database that has tables but no version table, because its history is unknown, and a database whose recorded version is newer than the newest migration in the binary, because it was written by a newer build.
Separate migration histories

Use goosestrict.NewStoreTable("feature_schema_version") when a library owns its own tables and tracks its migrations separately in a shared database. Pass the returned store to goose.NewProvider with goose.DialectCustom and goose.WithStore(store). Choose a name distinct from all other tables (ignoring case) and keep it stable across releases.

Names may contain 1 to 64 ASCII letters, digits, or underscores. They cannot start with a digit or with sqlite_ in any letter case. The custom table is STRICT, like goose_db_version. This is a store, not a replacement for the startup checks in goosestrict.NewProvider. If the application uses that provider, run its migrations first on a fresh database, then the library's.

Adopting an existing database

A database made by something other than goose (a PRAGMA user_version runner, or a schema created with CREATE TABLE IF NOT EXISTS and no migration table) has tables and no version table, so NewProvider refuses it. Adopt marks it as already being at a given migration version, once.

⚠️ Adopting at version N tells goose that migrations 1 to N are applied. Adopt cannot check that. If the real schema is behind N, goose will silently skip the missing migrations, and the application will run against a schema it does not match. Before calling it, verify the schema yourself: compare the tables and columns that exist with what migration N produces (for a schema with no migration table, the baseline migration, 1), and refuse to start if they differ. Back the database up first and rehearse on a copy.

// From a user_version runner: the version it recorded is the last migration it
// applied, provided your numbering matches (migration n is the state the old
// runner called version n).
var v int64
if err := db.QueryRowContext(ctx, `PRAGMA user_version`).Scan(&v); err != nil {
    return err
}
// ... verify the schema against migration v here ...
if err := goosestrict.Adopt(ctx, db, v); err != nil {
    return err
}

// From a schema with no migration table, adopt at the baseline:
//     verify the schema against migration 1, then
//     err := goosestrict.Adopt(ctx, db, 1)

Adopt creates the STRICT version table and records versions 0 to v as applied, in one transaction that takes the write lock first (BEGIN IMMEDIATE, whatever the connection string says), so two processes adopting together cannot both succeed: the second waits, then finds the table and refuses.

  • It refuses if the version table already exists, if v is below 1, and if v is above 100000. One row is written per version, so a project that numbers migrations by timestamp (20240101120000) cannot adopt this way: number the baseline sequentially, or adopt at a small version.
  • It does not look at the database's tables. It will adopt a database with none at all; whether that makes sense is the caller's call. A database with no tables does not need adopting: NewProvider accepts it as it is.
  • Call it only when the version table is absent. Adopt does not repeat.
  • On a fresh database NewProvider itself creates the STRICT version table and its version-0 row (it reads the versions to make its newer-than-binary check), before Up is called. Merely building a provider therefore writes to the database.

Migrating from several processes: MigrationLock

func MigrationLock(ctx context.Context, dbPath string) (release func() error, err error)

Goose works out which migrations are pending before it takes SQLite's write lock, and does not read the recorded version again inside the transaction. Two processes opening one database at once (replicas started together, or a restart that overlaps the old process) can therefore both decide migration 2 is pending and both apply it: the second fails with "duplicate column name", or an INSERT-style migration quietly runs twice. Eight concurrent opens of a fresh database fail this way reliably. MigrationLock serialises the migration step: the second process waits, then finds nothing pending.

Take the lock before the first query on the database, Check included. The busy timeout does not cover the very first open of a fresh database: while the file is created and switched to WAL, concurrent first queries can fail at once with SQLITE_BUSY. sql.Open does not connect, so it can come before or after the lock; the first query must come after.

Hold it across everything that must not overlap with another process's migration: Adopt, building the provider (which creates the version table on a fresh database), Up, and any application-specific check or data fix that follows. Release it before serving.

path := "data/notes.db"

// 1. The lock first: nothing has queried the database yet.
release, err := sqlitekit.MigrationLock(ctx, path) // waits, or returns ctx's error
if err != nil { /* ... */ }
defer release()

// 2. Open (this does not connect) and Check (the first query).
dsn, _ := sqlitekit.DSN(path, o)
db, err := sql.Open("sqlite", dsn)
if err != nil { /* ... */ }
if err := sqlitekit.Check(ctx, db, o); err != nil { /* ... */ }

// 3. Adopt if needed, then the provider and Up.
p, err := goosestrict.NewProvider(db, migrations)
if err != nil { /* ... */ }
if _, err := p.Up(ctx); err != nil { /* ... */ }
// ... post-migration checks ...

// 4. Release (the deferred call, or explicitly) before serving.
  • It is an flock(2) exclusive lock on <dbPath>.migrate-lock, created with mode 0600 next to the database and never deleted (removing a lock file that another process may hold or be about to open is a race). Pass the same path every process opens; a relative path is made absolute. The lock file is found by name: a symlink to the database file is a different lock file (a symlinked directory is fine). It is created by whichever user opens it first, like the database file itself, so run every process as the same user.
  • It waits, polling with a short backoff (10 ms doubling to 250 ms), until the lock is free or ctx is done, and then returns ctx's error, wrapped.
  • The kernel drops the lock if the holder dies, so a crash cannot wedge later starts. release is idempotent.
  • It works between processes, containers included, that share the directory on one host. It does not work across hosts or on network filesystems, where flock is unreliable and SQLite itself is unsafe anyway.
  • Supported on Linux, macOS and the BSDs; elsewhere it returns an error.

Changes

  • v0.4.0: Backups.Start, BackupSchedule, BackupResult, and BackupLoop add scheduled backups with retries, a per-run timeout, optional cross-process locking, and a report hook. If the context ends after VACUUM INTO but before the rename, Backups.Run now discards the temporary copy and returns the context error; previously it kept the complete, synced backup. A context already canceled before the run never produced a backup.
  • v0.3.0: goosestrict.NewStoreTable adds named STRICT version tables for independent goose migration histories. Version-table names are matched ignoring case, as SQLite does, so a table differing only in case is refused rather than attempted. NewStore keeps the unquoted DDL text that v0.2.0 wrote for the default table. Adds a LICENSE file.
  • v0.2.0: MigrationLock, a cross-process lock for the migration step.
  • v0.1.0: DSN, Check, Backups, and goosestrict (NewStore, NewProvider, Adopt).

Development

make fmt-check vet test vulncheck

The tests use modernc.org/sqlite against real files in temporary directories; nothing is mocked.

License

MIT No Attribution; see LICENSE.

Documentation

Overview

Package sqlitekit holds the SQLite settings and routines that every application using a SQLite file should share: a connection string that turns on the settings SQLite has off (DSN), a startup check that the driver really applied them (Check), and dated online backups with retention (Backups).

MigrationLock serialises schema migration across processes that open the same database.

The package uses only the standard library and imports no driver. It builds connection strings in the syntax of modernc.org/sqlite (driver name "sqlite"); the application imports the driver itself.

The subpackage goosestrict adapts github.com/pressly/goose/v3 to SQLite STRICT tables and is the only part of the module that depends on goose.

Index

Constants

View Source
const DefaultBusyTimeout = 5 * time.Second

DefaultBusyTimeout is the busy timeout used when Options.BusyTimeout is 0.

View Source
const MigrationLockSuffix = ".migrate-lock"

MigrationLockSuffix is appended to the database path to name the lock file.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, db *sql.DB, o Options) error

Check verifies, on one connection from db, that the settings DSN asks for are in effect, and returns an error naming each one that is not. Call it right after opening the database: a driver that ignores a parameter would otherwise run for months with foreign keys off or without WAL, and nothing would say so.

Each setting is per connection and DSN applies it to every connection, so one connection stands for the pool. secure_delete is checked only when o.SecureDelete is set; left unset, it is not required to be off.

Check cannot see _txlock: it is a driver option, not a SQLite setting, and no query reveals it. The package's tests prove it instead, by showing that a second connection cannot write while a transaction opened through database/sql is in progress.

func DSN

func DSN(path string, o Options) (string, error)

DSN returns the data source name for the SQLite file at path, in the syntax of modernc.org/sqlite:

db, err := sql.Open("sqlite", dsn)

The path is made absolute and escaped as a file: URL, so a space, "?" or "#" in it is part of the file name and never becomes driver configuration. The settings are passed as _pragma parameters, which the driver runs on every connection it opens, so each connection in the pool has them:

foreign_keys(1)    SQLite enforces no foreign key without it
busy_timeout(ms)   wait for a lock instead of failing at once
journal_mode(WAL)  readers do not block the writer
secure_delete(1)   only when Options.SecureDelete is set

plus _txlock=immediate, so a transaction takes the write lock at BEGIN, where the busy timeout applies, instead of failing when it first writes. path is a file path: ":memory:" and file: URLs are not supported.

func MigrationLock

func MigrationLock(ctx context.Context, dbPath string) (release func() error, err error)

MigrationLock takes an exclusive lock that serialises schema migration across every process that opens the database at dbPath, and returns the function that releases it. It waits until the lock is free or ctx is done; in the second case it returns ctx.Err(), wrapped.

Why it exists. Goose works out which migrations are pending before it takes SQLite's write lock, and does not read the recorded version again inside the transaction. Two processes opening one database at once (two replicas started together, or a restart that overlaps its predecessor) can therefore both decide that migration 2 is pending and both apply it. The second fails, for instance with "duplicate column name", or worse, succeeds twice. Holding this lock across the whole migration step makes the second process wait, and then find nothing pending.

Take it before the first query on the database, Check included. The busy timeout does not cover the very first open of a fresh database: while the file is being created and switched to WAL, concurrent first queries can fail at once with SQLITE_BUSY. sql.Open itself does not connect, so it may come before or after the lock; the first query must come after.

Hold it across everything that must not overlap with another process's migration: goosestrict.Adopt, building the goose provider (which creates the version table on a fresh database) and its Up, and any application-specific check or data fix that follows a migration. Release it before serving.

release, err := sqlitekit.MigrationLock(ctx, path)
if err != nil { return err }
defer release()
db, err := sql.Open("sqlite", dsn) // does not connect
// ... sqlitekit.Check, Adopt if needed, goosestrict.NewProvider,
// p.Up(ctx), post-checks ...

The lock is an flock(2) exclusive lock on the file dbPath + ".migrate-lock", created with mode 0600 next to the database if missing and never deleted: removing a lock file that another process may hold or be about to open is a race. The kernel drops the lock if the process dies, so a crash cannot keep it held. release is idempotent; the first call returns the error from unlocking, later calls return nil.

Scope. It works between processes, including containers, that share the same directory on one host. It does not work across hosts or on network filesystems, where flock is unreliable and SQLite itself is unsafe anyway. dbPath must be the path every process opens; use an absolute path, since a relative one is made absolute against the current directory. The lock file is found by name: a symlink to the database file is a different lock file, while a symlinked directory is fine. The lock file is created by whichever user opens it first, like the database file itself, so run every process as the same user.

It is supported on Linux, macOS and the BSDs. Elsewhere it returns an error.

Types

type BackupFile

type BackupFile struct {
	Name    string
	Size    int64
	ModTime time.Time
}

BackupFile describes one backup in Backups.Dir.

type BackupLoop

type BackupLoop struct {
	// contains filtered or unexported fields
}

BackupLoop is a running schedule. Its zero value represents a stopped loop.

func (*BackupLoop) Done

func (l *BackupLoop) Done() <-chan struct{}

Done is closed once the loop has returned (Stop, or ctx done). A nil or zero loop returns a closed channel.

func (*BackupLoop) Stop

func (l *BackupLoop) Stop()

Stop ends the loop and waits until its goroutine has returned, including a run or Report in progress (the run's context is canceled). Call it before closing db. Safe to call more than once, concurrently, and on a nil or zero loop.

type BackupResult

type BackupResult struct {
	Path string // today's backup; empty when Err is set
	Made bool   // this run wrote it
	Err  error
	Next time.Duration // wait before the next run (Interval or Retry)
}

BackupResult is the outcome of one scheduled run.

type BackupSchedule

type BackupSchedule struct {
	// Interval is the wait after a run that succeeded. Zero means one hour.
	// Run makes at most one backup per day, so an hourly check costs a stat
	// and a prune.
	Interval time.Duration
	// Retry is the wait after a run that failed. Zero means 15 minutes or
	// Interval, whichever is shorter. It must not exceed Interval or one
	// hour, so a failure is always retried within the hour.
	Retry time.Duration
	// Timeout bounds one run, including the wait for LockPath. Zero means
	// 5 minutes. A run that fails at the deadline reports an error wrapping
	// [context.DeadlineExceeded].
	Timeout time.Duration
	// LockPath, if set, names the flock file taken around each run. Sharing
	// it lets overlapping processes take turns instead of racing on the
	// same temporary backup. Use a separate file outside the backup folder,
	// never the database file or its -wal or -shm files.
	// It is created with mode 0600 if missing and never deleted. It must not
	// end in [MigrationLockSuffix], so backups do not hold up migrations.
	// It has the same platform and filesystem requirements as [MigrationLock].
	// Start rejects a non-empty LockPath on platforms without flock.
	LockPath string
	// Now picks the day. Nil means [time.Now].
	Now func() time.Time
	// Report receives the outcome of every run that was not cut short by the
	// loop stopping. Nil reports nothing. It runs on the loop's goroutine,
	// after the lock is released, and Stop waits for it. It must not call
	// Stop or wait on Done: the loop cannot return until Report returns.
	Report func(BackupResult)
}

BackupSchedule says when Backups.Start runs Backups.Run.

type Backups

type Backups struct {
	// Dir holds the backups. It must be a folder the process owns and that
	// holds only this application's backups: it is created if missing and set
	// to mode 0700 on every [Backups.Run], and Run fails if it cannot do that.
	Dir string
	// Prefix starts every backup's name, e.g. "notes-". It must not contain a
	// path separator.
	Prefix string
	// Layout is the [time] layout of the date in the name, e.g. "2006-01-02"
	// or "20060102". It must identify a day. A file is a backup only if the
	// text between Prefix and ".db" parses as a date in this layout.
	Layout string
	// Keep is how many of the newest backups to keep. Values below 1 are
	// treated as 1: a backup that has just been made is never pruned.
	Keep int
	// Location decides which calendar day "today" is. Nil means UTC.
	Location *time.Location
}

Backups takes one dated copy of a database per day into Dir and keeps the newest few. A copy is a complete, ordinary database file made with VACUUM INTO.

Run must not be called concurrently for the same Dir and Prefix; use a single caller. A concurrent call can fail, and the backup under today's name stays good.

Backups are for mistakes and corruption. They sit next to the database, so they do not survive the loss of the disk; copy them elsewhere for that.

func (Backups) List

func (b Backups) List() ([]BackupFile, error)

List returns the backups in Dir, newest first. A missing directory means no backups. Only files named Prefix + <a date in Layout> + ".db" are listed.

func (Backups) Run

func (b Backups) Run(ctx context.Context, db *sql.DB, now time.Time) (path string, made bool, err error)

Run writes today's backup, unless it already exists, then prunes. now picks the day (in Location). It returns the path of today's backup and whether this call made it.

The copy is written under a hidden temporary name, created with mode 0600 before SQLite writes to it, and renamed into place, so a crash never produces a half-written file under a name that looks like the day's backup. Temporary files left by earlier crashes are removed. Dir is set to mode 0700. A symlink or other non-regular file with today's name is an error.

VACUUM INTO reads inside one transaction, so the copy is the database at one instant even while other connections write; copying the file with cp is not safe for a WAL database, which keeps recent commits in a separate -wal file.

func (Backups) Start

func (b Backups) Start(ctx context.Context, db *sql.DB, s BackupSchedule) (*BackupLoop, error)

Start checks b and s, then runs b.Run at once and on schedule in one goroutine until ctx is done or Stop is called. The single goroutine is the one caller Run requires. An invalid Backups or schedule is returned as an error and nothing is started.

type Options

type Options struct {
	// BusyTimeout is how long a connection waits for a lock held by another
	// connection before failing with SQLITE_BUSY. Zero means
	// [DefaultBusyTimeout]. Negative, below one millisecond or above
	// 2^31-1 milliseconds (SQLite's limit) is an error.
	BusyTimeout time.Duration

	// SecureDelete overwrites deleted content with zeros, so deleted rows do
	// not linger in free pages of the file or of a backup. It costs some write
	// speed; turn it on only where deleted data must not survive.
	SecureDelete bool
}

Options are the choices left to the application. Foreign keys, WAL and immediate transactions are always on: each one guards against a failure that is silent when it is missing, so none of them is an option.

Directories

Path Synopsis
Package goosestrict runs github.com/pressly/goose/v3 migrations against SQLite databases whose tables are all STRICT, version table included, and refuses to guess when a database does not match its migrations.
Package goosestrict runs github.com/pressly/goose/v3 migrations against SQLite databases whose tables are all STRICT, version table included, and refuses to guess when a database does not match its migrations.

Jump to

Keyboard shortcuts

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