dbschema

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Helpers for building a database schema using migration files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx context.Context, db *sql.DB, schemaFiles fs.FS) error

Build a database schema by successively applying migration files as necessary.

schemaFiles must contain .sql files with consecutive numeric names like 001.sql, 002.sql, and so on. Files without a .sql suffix are ignored.

The database's current schema version is stored in the dbschema table.

Types

type TooNew

type TooNew struct {
	CurrentVersion int
	LatestVersion  int
}

TooNew is the error returned by Build when the database contains a schema version that is newer than the newest schema file.

func (*TooNew) Error

func (e *TooNew) Error() string

Jump to

Keyboard shortcuts

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