InitSchema migrates database schema to reflect the latest model definition
(db *gorm.DB)
| 50 | |
| 51 | // InitSchema migrates database schema to reflect the latest model definition |
| 52 | func InitSchema(db *gorm.DB) { |
| 53 | if err := db.AutoMigrate( |
| 54 | &User{}, |
| 55 | &Book{}, |
| 56 | &Note{}, |
| 57 | &Token{}, |
| 58 | &Session{}, |
| 59 | ); err != nil { |
| 60 | panic(err) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | // Open initializes the database connection |
| 65 | func Open(dbPath string) *gorm.DB { |
no outgoing calls
no test coverage detected