todo sqlite and inmemory repo
This commit is contained in:
@@ -14,21 +14,14 @@ type Migration struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
func Migrate() {
|
||||
db, err := sql.Open("sqlite3", "./habits.db")
|
||||
if err != nil {
|
||||
log.Fatal("Failed to open db pool")
|
||||
}
|
||||
|
||||
defer db.Close()
|
||||
|
||||
func Migrate(db *sql.DB) {
|
||||
migrationTableSql := `
|
||||
CREATE TABLE IF NOT EXISTS migrations(
|
||||
version INTEGER PRIMARY KEY,
|
||||
name VARCHAR(50)
|
||||
);`
|
||||
|
||||
_, err = db.Exec(migrationTableSql)
|
||||
_, err := db.Exec(migrationTableSql)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user