add init functions
This commit is contained in:
@@ -43,3 +43,13 @@ func (s *GormUserStore) Update(user *User) error {
|
||||
func (s *GormUserStore) Delete(id int64) error {
|
||||
return s.db.Delete(&User{}, id).Error
|
||||
}
|
||||
|
||||
func (s *GormUserStore) init() error {
|
||||
// AutoMigrate models
|
||||
err := s.db.AutoMigrate(&User{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to migrate User model: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user