mirror of
https://git.gibonuddevalla.se/go/dbschema.git
synced 2025-12-05 21:31:14 +01:00
Refactored, removed old remnants from v0.1.0, documentation added
This commit is contained in:
parent
a38bd4304f
commit
d290a67800
2 changed files with 66 additions and 31 deletions
20
schema.go
20
schema.go
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
Package dbschema is used to keep the SQL schema up to date.
|
||||
|
||||
func sqlProvider(dbName string, version int) (sql []byte, found bool) {
|
||||
// read an SQL file and return the contents
|
||||
return
|
||||
}
|
||||
|
||||
upgrader := dbschema.NewUpgrader()
|
||||
upgrader.SetSqlCallback(sqlProvider)
|
||||
|
||||
if err = upgrader.AddDatabase("127.0.0.1", 5432, "foo", "postgres", "password"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err = upgrader.Run(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
*/
|
||||
package dbschema
|
||||
|
||||
import (
|
||||
|
|
@ -8,6 +27,7 @@ import (
|
|||
"database/sql"
|
||||
)
|
||||
|
||||
// An upgrader verifies the schema for one or more databases and upgrades them if possible.
|
||||
type Upgrader struct {
|
||||
databases map[string]Database
|
||||
logCallback func(string, string)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue