feat: Users API, ownership transfer and removal of the legacy role string
This commit is contained in:
1 parent
094df63a7f
commit
80f7037d3a
124 files changed
+4644
-824
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
entity "RenewCMS/internal/infrastructure/persistence/models"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const (
|
||||
legacyUserRolesMarker = "legacy_user_roles"
|
||||
inviteRolesMarker = "invite_roles"
|
||||
)
|
||||
|
||||
func markerApplied(tx *gorm.DB, name string) (bool, error) {
|
||||
var count int64
|
||||
if err := tx.Model(&entity.MigrationMarker{}).Where("name = ?", name).Count(&count).Error; err != nil {
|
||||
return false, err
|
||||
}
|
||||
return count > 0, nil
|
||||
}
|
||||
|
||||
func applyMarker(tx *gorm.DB, name string) error {
|
||||
return tx.Create(&entity.MigrationMarker{Name: name, AppliedAt: time.Now()}).Error
|
||||
}
|
||||
Reference in new issue
Block a user