add comments to the examples

move-migrations-to-option
Mason Payne 2024-09-02 15:01:02 -06:00
parent 0ce907dbc1
commit 72df3adf0d
1 changed files with 2 additions and 0 deletions

View File

@ -14,6 +14,7 @@ func main() {
primaryUrl := os.Getenv("LIBSQL_DATABASE_URL") primaryUrl := os.Getenv("LIBSQL_DATABASE_URL")
authToken := os.Getenv("LIBSQL_AUTH_TOKEN") authToken := os.Getenv("LIBSQL_AUTH_TOKEN")
// Open the database
tdb, err := libsqldb.NewLibSqlDB( tdb, err := libsqldb.NewLibSqlDB(
primaryUrl, primaryUrl,
migrationFiles, migrationFiles,
@ -25,6 +26,7 @@ func main() {
os.Exit(1) os.Exit(1)
} }
// Migrate the database
err = tdb.Migrate() err = tdb.Migrate()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "failed to migrate db %s: %s", primaryUrl, err) fmt.Fprintf(os.Stderr, "failed to migrate db %s: %s", primaryUrl, err)