var ( ErrNilConfig = fmt.Errorf("no config") ErrNoDatabaseName = fmt.Errorf("no database name") ErrNoSchema = fmt.Errorf("no schema") ErrDatabaseDirty = fmt.Errorf("database is dirty") ErrMultipleAuthOptionsPassed = fmt.Errorf("both password and useMsi=true were passed.") )
DefaultMigrationsTable is the name of the migrations table in the database
var DefaultMigrationsTable = "schema_migrations"
func WithInstance(instance *sql.DB, config *Config) (database.Driver, error)
WithInstance returns a database instance from an already created database connection.
Note that the deprecated `mssql` driver is not supported. Please use the newer `sqlserver` driver.
Config for database
type Config struct { MigrationsTable string DatabaseName string SchemaName string }
SQL Server connection
type SQLServer struct {
// contains filtered or unexported fields
}
func (ss *SQLServer) Close() error
Close the database connection
func (ss *SQLServer) Drop() error
Drop all tables from the database.
func (ss *SQLServer) Lock() error
Lock creates an advisory local on the database to prevent multiple migrations from running at the same time.
func (ss *SQLServer) Open(url string) (database.Driver, error)
Open a connection to the database.
func (ss *SQLServer) Run(migration io.Reader) error
Run the migrations for the database
func (ss *SQLServer) SetVersion(version int, dirty bool) error
SetVersion for the current database
func (ss *SQLServer) Unlock() error
Unlock froms the migration lock from the database
func (ss *SQLServer) Version() (version int, dirty bool, err error)
Version of the current database state