Files
sm-user-plugin/updates/202610040002_add_users_last_seen.go
Jakub Zych e22f7660f3 feat: add the admin columns and the frontend permissions table
- users.permissions and users.last_seen as additive columns
- golem15_user_frontend_permissions (code, label, tab, comment)
- User gains LastSeen, read-only CreatedAt and UpdatedAt and the
  filterByGroup list scope; none of them is serialized
- migration tests roll back by position past the three new steps
2026-10-05 12:51:41 +02:00

25 lines
628 B
Go

package updates
import (
"github.com/go-gormigrate/gormigrate/v2"
"gorm.io/gorm"
)
// The users.last_seen column of PHP updates/v1.2.6/users_add_last_seen.php.
// The auth path stamps it on login and on token refresh.
var usersLastSeenMigrations = []*gormigrate.Migration{
{
ID: "202610040002_add_users_last_seen",
Migrate: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE users ADD COLUMN last_seen TIMESTAMPTZ NULL`).Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE users DROP COLUMN IF EXISTS last_seen`).Error
},
},
}
func init() {
Register(usersLastSeenMigrations...)
}